我使用Microsoft Visual Studio Community 2015 RC(版本14.0.22823.1 D14REL)收到与STL相关的链接错误
我正在链接一个C ++ DLL并成功使用STL中的许多函数,但它找不到与std :: codecvt相关的东西:
error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class std::locale::id std::codecvt<char32_t,char,struct _Mbstatet>::id" (__imp_?id@?$codecvt@_UDU_Mbstatet@@@std@@2V0locale@2@A)
导致此问题的源代码引用:
std::wstring_convert< std::codecvt_utf8<char32_t>, char32_t > convert;
我的代码生成用于多线程dll,我已通过详细链接验证在链接时搜索MSVCPRT.lib。
有什么想法吗?
答案 0 :(得分:3)
澄清问题和解决方案:Microsoft承认std::codecvt
不是针对Microsoft Visual Studio 2015 RC提供的std库中的char32_t
构建的。解决方法是使用unsigned int
或__int32
类型:
std::wstring_convert< std::codecvt_utf8<unsigned int>, unsigned int > convert;
或
std::wstring_convert< std::codecvt_utf8<__int32>, __int32 > convert;
而不是
std::wstring_convert< std::codecvt_utf8<char32_t>, char32_t > convert;