DelphiFAQ Home Search:

fatal error C1010 - unexpected end of file while looking for precompiled header directive


comments56 comments. Current rating: 4 stars (22 votes). Leave comments and/ or rate it.


I try to compile a program with Visual C++ .NET (dot-net) which was originally written for the Apple Macintosh for Objective-C. I keep getting the following error message:

"fatal error C1010 - unexpected end of file while looking for precompiled header directive"

I looked into the header file but cannot find anything to be missing.


MFC programs use many libraries, requiring the use of many header files. To save time, the compiler tries to precompile most of these header files, and use the predigested data instead of reading through all of these header files on every compilation. There are a number of ways to do this. The standard method for MFC programs is to lump all of these common header file references into one header file ("stdafx.h"). If you just have to ask what "stdafx" means, it comes from the early name of MFC, which was AFX (application framework).

When compiling each source (.cpp) file, the compiler skips through the source code, looking for the directive:

#include "stdafx.h"

Once it finds this directive, it substitutes the precompiled header information and then begins compiling the rest of the file. If your source file doesn't contain this directive, you get the C1010 error described above.

The simple solution is to insert the include directive to your source file, before any other library references or other code.

Content-type: text/html


You are on page 4 of 4, other pages: 1 2 3 [4]
2008-10-30, 08:28:03
anonymous from India  
hi gy .., i am from hyderabad .., i have been suffering from this doubt since last 4 months .., but fortunately i saw ur answer .., i am very thankful to u a lot..,
2009-02-22, 23:59:21
anonymous from China  
I meet the same question ,too.
2009-12-07, 23:35:15
anonymous from India  
Thanks this post was very helpful
2009-12-26, 03:50:40   (updated: 2009-12-26, 03:51:23)
anonymous from India  
thanks information was great.
if the file stdafx.h is already added to project then u should add the code #include 'stdafx.h' to your main cpp file which you have named in starting.
2010-01-07, 04:23:53
anonymous from Pakistan  
solved my prblem in less than a min. Thanks for posting.
2010-01-12, 03:51:03
#include ''stdafx.h''
Your methods was helpful for me
2010-03-09, 13:46:07
i am a beginner , and i am faceing this problem , would you plz help

fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.

the file is .c
my coding is :

#include <stdio.h>
#define KMS_PER_MILE 1.609
int main()

    int KMS_PER_MILE;
    double miles;
    int kms;
    printf('Enter the distance in miles\n');
    scanf('%lf', &miles);
    kms = KMS_PER_MILE * miles;
    printf('That equals %f',kms);
2010-03-28, 05:43:11
zblroxsk from Czech Republic  
2012-07-23, 22:38:59
anonymous from United States  
2015-01-30, 01:13:45
Arltices like this just make me want to visit your website even more.
2015-01-30, 14:16:44
Hi Michelle,Sorry, the Essentials course doesn't go into teatmlpe modification. The range of skills required to do that (HTML, CSS, PHP, and occasionally JavaScript) are fairly advanced for the average non-technical user. It's likely I'll be doing a new course specific to WordPress themes in the coming year (I realize that doesn't help you right now). Please sign up for the mailing list if that's something you're interested in.To answer your specific question, it shouldn't be a problem to float your images to the left of your text on the home page. For a traditional blog-style WordPress site the home page layout is controlled by the index.php file. [url=]..pifj[/url] [link= http://ambktsayui.c..yui[/link]
You are on page 4 of 4, other pages: 1 2 3 [4]



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: