How to fix linkage when use codecvt+char16_t in MSS2015?

582 views Asked by At

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?

0

There are 0 answers