Question#include "stdafx.h"?

Posts 1–5 of 5 · Page 1 of 1
#include "stdafx.h"?
Hello all!

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:


Code:
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.

Thanks in advance!
Dolebat
The person who wrote that tutorial is a gigantic homo****** then. You only include stdafx.h when you let microsoft create the console32 app for you.

When creating a project check the "Empty Project" checkbox(don't know what it says exactly), then you won't need stdafx.h
Gotcha, thanks a bunch!
Lolol telling people to use precompiled headers without explaining them and with Hello World ?
Tick empty project next time
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Need help?