我的SuperViewer工程启动了。拿起老古董MFC,感觉挺爽的。我一向没怎么好好做过UI,为了我的SuperViewer,拼了!
期间会遇到各种问题。
Question:
I try to compile a program with Visual C++ 6.0, which was originally written for the Windows. 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:
#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.