Link to home
Start Free TrialLog in
Avatar of InteractiveMind
InteractiveMindFlag for United Kingdom of Great Britain and Northern Ireland

asked on

stdafx.h ?

I'm using Visual Studio 2005 Pro, and when I create a Win32 Console app [without including the stdafx.h header], I get the following compilation error:

fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

When I do include this header, it all compiles fine.

But, why is VS insisting on it? All stdafx.h contains on my comp, is:

#pragma once
#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <tchar.h>

What's so special about it?


Thanks
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of InteractiveMind

ASKER

Could you please give me a brief explanation of what precompiled headers are?

Thanks
'Precompiled headers' basically are already parsed headers that are stored in binarily in .pch files to speed up compilation. If these are present, the compiler can read the information directly from them instead parsing the header files again. This is particularly useful for e.g. Windows SDK headers, since they are quite large and hardly ever change.
Oh right, pretty self explanatory I guess - hehe
Makes great sense.

Thank you. :D