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

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
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)
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.
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.
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.
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.
Well, would it be better to get rid of it and change the options since I'm still learning, or just leave it alone?
Get rid of it.

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.
lol
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.