I am learning C++ and using MS Visual Studio 2010 as my IDE. I am following the tutorials at LearnCPP.com and on the first tutorial I hit a snag. In the tutorial 0.6 it clearly states: Important note to Visual Studio users: Visual studio programs should ALWAYS begin with the following line:
#include "stdafx.h"
When I do that on the Hello World program I get the following error:
Code:
1 2 3 4 5 6 7 8 9 10 11
1>Build started 3/29/2011 2:18:18 PM.
1>InitializeBuildStatus:
1> Touching "Debug\HelloWorld.unsuccessfulbuild".
1>ClCompile:
1> Helloworld.cpp
1>c:\users\jon\documents\visual studio 2010\projects\helloworld\helloworld\helloworld.cpp(2): fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.25
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
If I build or Run [Without Debugging], leaving out #include "stdafx.h" it works fine. I know since I got it working, It shouldn't matter, but its bugging me and I have a feeling it might trip me up later if I don't know.
Important note to Visual Studio users: Visual studio programs should ALWAYS begin with the following line:
That tutorial is wrong. You only need stdafx.h if you make a project that has some prebuilt settings. If you choose to make an empty project with VS, you don't need it.