Visual Basic (3539)
About this site
Links to us
General :: Programming :: C++
This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Generated 20:01:04 on Jun 4, 2020
fatal error C1010 - unexpected end of file while looking for precompiled header directive
Question: 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.
Answer: 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:
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.
|Most recent comments