6

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 ?

topspin
  • 161
  • 2
  • 9
  • An update: Microsoft replied about this on MSDN (known issue): https://social.msdn.microsoft.com/Forums/en-US/8f40dcd8-c67f-4eba-9134-a19b9178e481/vs-2015-rc-linker-stdcodecvt-error?forum=vcgeneral – topspin Jun 11 '15 at 00:26

1 Answers1

3

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;
GaspardP
  • 4,217
  • 2
  • 20
  • 33
  • 3
    This workaround works but it induces the issue that your basic_string also has to be based on unsigned int. This is just hell. – Ident Nov 22 '15 at 21:38