Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

stdafx.h ?

Posted on 2006-06-23
4
Medium Priority
?
1,192 Views
Last Modified: 2006-11-18
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
Comment
Question by:InteractiveMind
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 16972601
'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
 
LVL 25

Author Comment

by:InteractiveMind
ID: 16972627
Could you please give me a brief explanation of what precompiled headers are?

Thanks
0
 
LVL 86

Expert Comment

by:jkr
ID: 16972661
'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
 
LVL 25

Author Comment

by:InteractiveMind
ID: 16972676
Oh right, pretty self explanatory I guess - hehe
Makes great sense.

Thank you. :D
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question