Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Saturday, September 9, 2017 2:43 AM
#include <iostream>
int main()
{
std::cout << "Hello World!";
}
Came up with 458 errors after saying "This project is out of date: Project2 - Win 32." Then it says "There were build errors. Would you like to continue and run the last successful build?" Help is much appreciated as this is due on Monday :) if you need more info, ask. I'll bookmark this page and check often.
Thanks in advance!
Dustin
All replies (21)
Monday, September 11, 2017 7:09 AM ✅Answered | 1 vote
Note that in the last screenshot in the output window the path is so long that the error message is not shown. It would have been better to copy that line and paste it into your reply.
I think I know what the message says essentially at least. I think it is saying that you did not install the Windows 10 SDK. So you need to add that to your VS setup. Look for the vs_installer.exe program, it is probably in:
C:\Program Files (x86)\Microsoft Visual Studio\Installer
Also see Modify Visual Studio 2017. Look at "Workloads" in the window shown in Step 3. You should have "Desktop development with C++" for your installation like that.
Also, in your setup, find "Desktop development with C++" in the right side and expand that. It should have at least one "Windows 10 SDK" selected. In the following image, I have three versions selected and one version not selected. I don't know which versions are appropriate for you; you probably need at least one version equal to or lesser than the version of Windows 10 on your system.
I am not sure that that will be everything you need but you probably must have that much.
Sam Hobbs
SimpleSamples.Info
Saturday, September 9, 2017 6:01 AM
When you see “There were build errors…”, close the dialog. Then you should see the Errors window. Or select from menu: View, Error List. Try solving the errors and give us the details.
Saturday, September 9, 2017 12:45 PM
If you are a programmer devoloping some software, I'm afraid you might have forgot providing your developing environment, at least your programming language.
Ashidacchi
Saturday, September 9, 2017 6:19 PM
See Getting Started with C++ in Visual Studio. You should do the walkthrough as it is and create the program it shows. You will then have experience with the basics at least.
Note that your program has "#include <iostream>" at the beginning. This is correct and totally normal and you can do that in programs you use Visual Studio (VS) for but for VS the convention is for most C++ programs to just have "#include <stdafx.h>" at the top and most #includes are put in the stdafx.h file. That walkthrough will show you what I mean.
That walkthrough will also show you how to create the project. That is important. Probably you did not create the project correctly so VS does not know what to compile.
Sam Hobbs
SimpleSamples.Info
Sunday, September 10, 2017 12:12 AM
I figured that you should be able to tell by the "cout"
Sunday, September 10, 2017 12:15 AM
I went through and followed the steps as it said, and it still popped up a ton of errors. The were on random lines
Error (active) E0757 variable "_ACRTIMP" is not a type name line 143
There is only 12 lines of code on my program. I put a break point after line 12 to try and stop those errors from popping up but to no avail. 460 errors this time.
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!\n";
return 0;
}
Sunday, September 10, 2017 12:16 AM
Also, this is a Visual Studios thread. Why would i have to specify that I'm using Visual Studios?
Sunday, September 10, 2017 1:37 AM
First, the "#include <iostream>" should be in the stdafx.h file. The C++ language does not care whether you use the stdafx.h file but Microsoft wants us to do things their way. You can do things differently but you must know enough about VS to know what to do. In this case, it is better to do it the Microsoft way. Look at the walkthrough; it will show that the "#include <iostream>" should be in the stdafx.h file. I don't know if that will have any affect but that is all I can say based on the information provided.
Breakpoints are for execution. They have no affect on the compiler. You must get the program compiled first; otherwise there is nothing to execute and therefore any breakpoint is not relevant.
The only other thing I can say is that computers often panic when we panic. You need to slow down and be sure you are doing it correctly. You might be in too much of a hurry and overlooking something.
Sam Hobbs
SimpleSamples.Info
Sunday, September 10, 2017 2:35 AM
Alright thanks for the help man! I was trying to post screenshots, but microsoft has an automatic safeguard against spammers. I need more age on my account :(
Sunday, September 10, 2017 3:58 AM
You can use cloud storage such as OneDrive, Dropbox, etc. for sharing screenshots.
Ashidacchi
Sunday, September 10, 2017 9:43 PM
https://1drv.ms/f/s!AqFDTn5nVJr0Z76UhRalgKC9hkg
Here's a couple different things i tried. Didn't work though.
Sunday, September 10, 2017 10:10 PM
Probably you have somehow messed up your project properties. Click in "Project" in the menu and select "Properties". Does it look as in the following?
The Include Directories should have "$(VC_IncludePath);$(WindowsSDK_IncludePath);" in it. If not then I suppose you can just copy from here and paste into there.
If that is not the problem then it is likely you have messed something else up but it is difficult to say what to look at. If you can remember changing something like that then it will help us to now what you did. Or you can try doing a repair of VS but I don't know how to do that.
Sam Hobbs
SimpleSamples.Info
Monday, September 11, 2017 2:38 AM
Nah I didn't change any settings. But I'll go find that page and screenshot it and reshare the onedrive link.
Monday, September 11, 2017 2:46 AM
https://1drv.ms/f/s!AqFDTn5nVJr0Z76UhRalgKC9hkg
So I added an updated screenshot and a reply from my professor. I didn't fully understand his reply but I didn't want to bother him further. Maybe y'all have some insight.
Monday, September 11, 2017 3:53 AM
Hi dustin.simmons,
What's C++ project type do you create?
According to your screenshots, it seems that you just create a empty C++ project. There doesn't have any .h files in the Header Files folder.
The "stdafx.h" file should be contained in Header Files folder if you create a default Win32 Console application. This is why in your project, it could not find stdafx.h file when compiling.
Please create a default Win32 Console application by File -> New -> Project -> Visual C++ -> Win32 -> Win32 Console application -> Finished. Then it will generate a default Win32 Console application which contains "stdafx.h" file.
In addition, the "<iostream>" file is stored under Program Files (x86)\Microsoft Visual Studio 14.0\VC\include. Please check it is existing or not.
If not existing, there has any problem in your Visual Studio installation, please repair your Visual Studio.
If existing, please try run your Visual Studio as administrator to make sure it has enough permission to do any operations.
Best Regards,
Weiwei
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].
Monday, September 11, 2017 3:53 AM
I think your professor did not look at your screenshots very closely.
You added the #include "stdafx.h", correct? I don't see a stdafx.cpp so if you added the stdafx.h then your professor's comment is not relevant to the problem you are having.
I doubt that the solution suggested by the professor will solve the problem your are having. One of the error messages says that it can't open "errno.h". Use or misuse of pre-compiled headers I think would not cause that error, unless you deleted the file stdafx.cpp from the project. I can explain but you probably won't understand. The stdafx.cpp file (as seen in the following):
Is used to generate pre-compiled headers when needed. If you did a compile and then deleted the stdafx.cpp then it won't rebuild the pre-compiled headers when it should.
I don't understand why they are teaching you Visual Studio and not teaching you how to use it the Microsoft way. It makes me think that the professor does not adequately understand pre-compiled headers. Under the circumstances you should do it the way the professor says to. Create a new project; after "File" | "New" | "Project" choose "Windows Desktop Wizard" as in the following:
That is what you did, correct? Then in the "Windows Desktop Project" window uncheck "Precompiled Header" and check "Empty Project" as in the following:
Try that. Hopefully whatever is the current problem won't be a problem in the new project.
Sam Hobbs
SimpleSamples.Info
Monday, September 11, 2017 4:07 AM
Please create a default Win32 Console application by File -> New -> Project -> Visual C++ -> Win32 -> Win32 Console application -> Finished. Then it will generate a default Win32 Console application which contains "stdafx.h" file.
That would work for all (recent) versions of VS but for VS 2017 projects the way to create them seems to have been changed. His solution/project is called "Project1" and that name would be generated as the default name for the VS 2017 project "wizard".
In addition, the "<iostream>" file is stored under Program Files (x86)\Microsoft Visual Studio 14.0\VC\include. Please check it is existing or not.
An easy way to check if an #include file exists is to right-click the file name and choose "Open document". If the #include file exists in any of the specified directories then VS will open it. If VS says it can't find the file then we can do as you say and look at where we assume it is at.
Sam Hobbs
SimpleSamples.Info
Monday, September 11, 2017 5:15 AM
https://1drv.ms/f/s!AqFDTn5nVJr0Z76UhRalgKC9hkg
No dice gentleman. Checked to see if file would open, it opened. Opened new project the way you specified, but to no avail added a couple error screenshots to the onedrive
Monday, September 11, 2017 5:09 PM
Alrighty so I went through all of my workloads and checked the information you provided, and when I debugged, it popped up one error and it basically said I needed the Windows 8.1 SDK. Installed it, and its running like a dream! Y'all are amazing!
Monday, September 11, 2017 5:10 PM
https://1drv.ms/f/s!AqFDTn5nVJr0Z76UhRalgKC9hkg
Monday, September 11, 2017 8:00 PM
Excellent. I should have explained that you don't need everything shown in that image but anything you don't need is not likely to be a problem except it takes up space. You probably will never use CMake, ATL, MFC and CLang/C2.
At least you learned from all that. I hope you learn how to do things the Microsoft way using the stdafx.h. Computer performance is improved enough that pre-compiling headers is less important but if you are using Visual Studio then you should understand the Microsoft way of using pre-compiled headers.
Sam Hobbs
SimpleSamples.Info