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