使用VS 2015 RC的链接器错误,找不到与std :: codecvt相关的符号

时间:2015-06-10 19:11:43

标签: visual-studio c++11 stl codecvt

我使用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。

有什么想法吗?

1 个答案:

答案 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;