3

I used char16_t type with codecvt in followind code in MSVS2015:

std::u16string utf8_to_tf16(const std::string& str)
{
    std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
    return convert.from_bytes(str);
}

std::string utf16_to_utf8(const std::u16string& str)
{
    std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
    return convert.to_bytes(str);
}

It`s compiled successfully, but there are appears error during linkage:

error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class std::locale::id std::codecvt::id" (__imp_?id@?$codecvt@_SDU_Mbstatet@@@std@@2V0locale@2@A)

How to fix this error?

ildjarn
  • 62,044
  • 9
  • 127
  • 211
AeroSun
  • 2,401
  • 2
  • 23
  • 46
  • 4
    There is no fix, only [an active bug report](https://connect.microsoft.com/VisualStudio/feedback/details/1348277/). – ildjarn Jan 24 '16 at 12:17

0 Answers0