编译unexpected end of file while looking for precompiled header directive的问题

1.unexpected end of file while looking for precompiled header directive

A1、右键点工程名,选设置,然后选c/c++属性页,再选catagory选单中选 precompiled header ,将选项置成no use 或者autometic

A2、好像是工程中设置了预编译头文件,但你的程序中事实上没有添加这个头文件. 主要是stdafx.h Project Setting->C/C++ -> Category(Precompiled header)->not using Precompiled header试试

下面是msdn的说法: Fatal Error C1010 unexpected end of file while looking for precompiled header directive A precompiled header was specified, but it did not contain a precompiled header directive. This error can be caused by specifying an incorrect file as a header file, or by specifying an include file with the /Yu (Use Precompiled Header) command line option that is not listed in the source file as an include file.

 注:http://hi.baidu.com/chinapegasus/blog/item/27ede14f949d5133afc3ab9a.html

2.

LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 >

[Project] --> [Settings] --> 选择"Link"属性页, 在Project Options中将/subsystem:console改成/subsystem:windows  

2. Console子系统设置错误, 提示:  LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 >

控制台项目要使用Console子系统, 而不是Windows, 设置:

[Project] --> [Settings] --> 选择"Link"属性页,  在Project Options中将/subsystem:windows改成/subsystem:console

3. 程序入口设置错误, 提示: msvcrtd.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16 

通常, MFC项目的程序入口函数是WinMain, 如果编译项目的Unicode版本, 程序入口必须改为wWinMainCRTStartup, 所以需要重新设置程序入口:

[Project] --> [Settings] --> 选择"Link"属性页,  在Category中选择Output,  再在Entry-point symbol中填入wWinMainCRTStartup, 即可

4. 线程运行时库设置错误, 提示:   nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex  nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex

这是因为MFC要使用多线程时库, 需要更改设置:

[Project] --> [Settings] --> 选择"C/C++"属性页,   在Category中选择Code Generation,  再在Use run-time library中选择Debug Multithreaded或者multithreaded  咸鱼游侠(75374355) 12:11:11  其中,  Single-Threaded 

          

   单线程静态链接库(release版本)  Multithreaded              

   多线程静态链接库(release版本)  multithreaded DLL            

 多线程动态链接库(release版本)  Debug Single-Threaded

  单线程静态链接库(debug版本)  Debug Multithreaded         

  多线程静态链接库(debug版本)  Debug Multithreaded DLL   

 多线程动态链接库(debug版本)

单线程: 不需要多线程调用时, 多用在DOS环境下 

多线程: 可以并发运行

 静态库: 直接将库与程序Link, 可以脱离MFC库运行

 动态库: 需要相应的DLL动态库, 程序才能运行

 release版本: 正式发布时使用  debug版本: 调试阶段使用


文章出处:http://www.diybl.com/course/3_program/c++/cppjs/2008619/126655.html

posted on 2009-02-20 10:41 wrh 阅读(7158) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


导航

<2008年4月>
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

统计

常用链接

留言簿(19)

随笔档案

文章档案

收藏夹

搜索

最新评论

阅读排行榜

评论排行榜