Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linker error using VS 2015 RC, can't find symbol related to std::codecvt

I'm getting an STL-related link error, using Microsoft Visual Studio Community 2015 RC (Version 14.0.22823.1 D14REL)

I'm linking a C++ DLL and successfully using many functions from the STL, but it can't find stuff related to 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)

The source code reference causing this issue:

std::wstring_convert< std::codecvt_utf8<char32_t>, char32_t > convert;

My code generation is for multithread dll, and I have verified through verbose linking that MSVCPRT.lib is being searched at link time.

Any ideas ?

like image 616
topspin Avatar asked Jun 10 '15 19:06

topspin


1 Answers

To clarify the issue and the solution: Microsoft acknowledged that std::codecvt is not built against the char32_t in std library provided with Microsoft Visual Studio 2015 RC. The workaround is to use the unsigned int or the __int32 types:

    std::wstring_convert< std::codecvt_utf8<unsigned int>, unsigned int > convert;

or

    std::wstring_convert< std::codecvt_utf8<__int32>, __int32 > convert;

instead of

    std::wstring_convert< std::codecvt_utf8<char32_t>, char32_t > convert;
like image 84
GaspardP Avatar answered Oct 15 '22 18:10

GaspardP