【发布时间】:2012-03-16 16:46:33
【问题描述】:
我们刚刚将我们的应用程序“移植”到了 Unicode,我在一些链接上遇到了困难。
我想知道我是否可能遗漏了一些其他标志,因为我不确定下面的名字 mangling 是什么意思:
这是我得到的链接错误
错误 31 错误 LNK2019: 无法解析的外部符号“public: class boost::shared_ptr __thiscall ResourceManager::GetImage(class
std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short>> const &,bool)" (?GetImage@ResourceManager@@QAE?AV?$shared_ptr@VPngImage@@@boost@@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@_N @Z) 在函数“public: long __thiscall ATL::CAxWindowT::QueryHost(struct _GUID const &,void * *)”中引用 (?QueryHost@?$CAxWindowT@VCWindow@ATL@@@ATL@@QAEJABU_GUID@@PAPAX@Z) wndGroupSearch.obj
方法在代码中。它是这样声明的:
boost::shared_ptr<PngImage> GetImage(const tstring& name, bool bLocalizedOnly = false );
当我在未链接的库上运行 dumpbin 时,我得到以下信息:
public: class boost::shared_ptr<class PngImage> __thiscall ResourceManager::GetImage(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &,bool))
?GetImage@ResourceManager@@QAE?AV?$shared_ptr@VPngImage@@@boost@@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@_N@Z
当我转储调试版本(链接正确)时,我在 lib 的转储箱中得到以下内容
public: class boost::shared_ptr<class PngImage> __thiscall ResourceManager::GetImage(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &,bool)" (?GetImage@ResourceManager@@QAE?AV?$shared_ptr@VPngImage@@@boost@@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@_N@Z)
?GetImage@ResourceManager@@QAE?AV?$shared_ptr@VPngImage@@@boost@@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@_N@Z (public: class boost::shared_ptr<class PngImage> __thiscall ResourceManager::GetImage(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &,bool))
是否有一些提升问题或者我缺少一个编译或链接标志来解决这个问题?
它适用于我们的调试 unicode 版本,但不适用于发布版本。我还没有找到为什么重命名的名字看起来不同:
?$basic_string@GU?$char_traits 对比 ?$basic_string@_WU?$char_traits
更友好的名字是:
ResourceManager::GetImage(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &,bool)
对
ResourceManager::GetImage(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &,bool))
wchar_t 和 GU vs unsigned short _WU
有什么建议吗?
【问题讨论】:
标签: c++ visual-studio-2008 boost unicode linker