MFC的使用- fatal error C1010 的原因 (SuperViewer 开篇语)

我的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.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值