debug : LNK2019
发布日期:2021-06-30 22:15:08 浏览次数:2 分类:技术文章

本文共 1438 字,大约阅读时间需要 4 分钟。

使用vs2005 + STLport-5.2.1,  编译时出现LNK2019错.

Error	1	error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall stlp_std::basic_string
,class stlp_std::allocator
>::~basic_string
,class stlp_std::allocator
>(void)" (__imp_??1?$basic_string@GV?$char_traits@G@stlp_std@@V?$allocator@G@2@@stlp_std@@QAE@XZ) referenced in function _wmain srcVoteState.obj

用屏蔽法定位到

std::wstring strRc;

想起在编译选项时,改过选项 wchar_t build in, 使wchar不为内建类型(/Zc:wchar_t-).

 回想StlPort编译过程, 当时选择的是默认选项编译, 没有选择 /G7 选项.  将vs2005工程的wchar_t build in 改回yes编译通过.

stlPort 编译时使用 wchar_t build in 选项如下:

 

echo.echo "--extra-cxxflag 
"echo Use this option to add any compilation flag to the build system. For instanceecho it can be used to activate a specific processor optimization depending on yourecho processor. For Visual C++ .Net 2003, to activate pentium 3 optim you will use:echo --extra-cxxflag /G7echo If you have several options use several --extra-cxxflag options. For instanceecho to also force use of wchar_t as an intrinsic type:echo --extra-cxxflag /G7 --extra-cxxflag /Zc:wchar_t

如果加载的第三方库多了, 出现LNK2019, 就需要将所有Lib的wchar_t build in 选项统一. 比如codeproject上的一些demo, 如果不选(/Zc:wchar_t-), 就编译不过.

<2011_1026>

今天,同事遇到vs2003ide中贴入vs2005工程中拷贝进来的代码, 编译不过提示是 "不可是别的0xA6", 用另存编码的方法没解决问题。后来他查到是贴进来的代码中用到的宏编码不正确,但是这个宏在另外一个文件中粘贴进来的. 后来他手工键入了那个宏,搞定. 看来修改要一小步一小步的来, 要不这种奇怪得问题,不好排查。

转载地址:https://lostspeed.blog.csdn.net/article/details/6897938 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:mongoc_client_command_simple
下一篇:experiment: State machine

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2024年04月24日 03时09分06秒