WindowsCE 下常見錯誤及分析

來源:互聯網
上載者:User

1. Windows子系統設定錯誤, 提示:

libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main

Windows項目要使用Windows子系統, 而不是Console, 可以這樣設定:

[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

注意:後邊的/incremental:yes也得去掉

 

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

其中,

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版本: 調試階段使用

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.