Why do you have to include stdafx.h in Visual Studio?

Jan 24, 2011 at 11:30pm
Why do you have to include stdafx.h in Microsoft Visual Studio. What does it do? In the file it sounds like this is where you should put the header files.
Last edited on Jan 24, 2011 at 11:30pm
Jan 26, 2011 at 3:34am
Does anybody know? I did some googling and still couldn't find a clear cut answer. (I won't bump this again if no one knows)
Jan 26, 2011 at 5:06am
closed account (4Gb4jE8b)
stdafx.h is just a local file created for the sole purpose of holding on you're header files. If you don't want it, delete it and don't include it in your main cpp file.
Jan 26, 2011 at 5:54am
I think it's for some MFC/ATL crap that you're probably not using. It's totally unnecessary and ridiculous.

When you make a new project, just be sure to select the "empty project" option, then you don't have to bother with that file.
Jan 26, 2011 at 5:59am
MFC/ATL crap


I think above is quite 'heavy-handed'. From what I know, a lot of commercial organizations do use MFC/ATL extensively in their finished software product.

ATL btw is called Active Template Library ? It allows non-C++ applications to call C++ made component ? I knew I uses it instead of create it back in those Visual Basic programming days.
Jan 26, 2011 at 11:29am
closed account (z05DSL3A)
stdafx.h is used for precomiled headeres, if you delete it go to the project properties and turn off use precompiled headers else you will have an error.
Jan 26, 2011 at 6:13pm
Well, would it be better to get rid of it and change the options since I'm still learning, or just leave it alone?
Jan 26, 2011 at 6:14pm
Get rid of it.

Jan 26, 2011 at 6:17pm
Return 0 wrote:
Get rid of it.
Said Lord Return 0 as he sat upon his porcelain throne.

In all seriousness, just remove it. Its not standard and just impairs your learning.
Jan 26, 2011 at 6:22pm
lol
Jan 26, 2011 at 6:28pm
closed account (z05DSL3A)
wolfgang wrote:
and just impairs your learning.

I fail to see how it can impair your learning.

Topic archived. No new replies allowed.