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

1

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 ?

Soloist answered 10/6, 2015 at 19:11 Comment(1)
An update: Microsoft replied about this on MSDN (known issue): social.msdn.microsoft.com/Forums/en-US/…Soloist
M
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;
Margenemargent answered 5/7, 2015 at 17:29 Comment(1)
This workaround works but it induces the issue that your basic_string also has to be based on unsigned int. This is just hell.Sundew

© 2022 - 2024 — McMap. All rights reserved.