Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1223
  • Last Modified:

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
0
InteractiveMind
Asked:
InteractiveMind
  • 2
  • 2
1 Solution
 
jkrCommented:
'StdAfx.h' is VC's default setting to generate it's precompiled headers for. You can change the file's name to one different from that or turn off the precompiled header feature completely in your Project settings under 'C++|Precompiled Heades'. However, when your projects grow larger, turning that off might have a big impact on compile speed.
0
 
InteractiveMindAuthor Commented:
Could you please give me a brief explanation of what precompiled headers are?

Thanks
0
 
jkrCommented:
'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.
0
 
InteractiveMindAuthor Commented:
Oh right, pretty self explanatory I guess - hehe
Makes great sense.

Thank you. :D
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now