Initializing TagLib::FileName with a 'const wchar_t *' array

Lukáš Lalinský lalinsky at gmail.com
Mon Aug 29 11:02:04 UTC 2011


On Mon, Aug 29, 2011 at 12:42 PM, Wolfgang Plaschg
<wolfgang.plaschg at gmail.com> wrote:
> Hello,
>
> when I try to initialize a TagLib::FileName object with a `const
> wchar_t*` array, I get the following linker error:
>
> main.obj : error LNK2019: unresolved external symbol
> "__declspec(dllimport) public: __thiscall
> TagLib::FileName::FileName(unsigned short const *)"
> (__imp_??0FileName at TagLib@@QAE at PBG@Z) referenced in function _main
>
> The source I tried to build is nothing more but:
>
> #include <taglib/mpegfile.h>
>
> int main(int , char** )
> {
>    const wchar_t* wt = L"test.mp3";
>    TagLib::FileName filename_w(wt);
> }
>
> I compiled taglib with MSVC 2008 in debug mode and I'm referencing the
> corresponding debug .lib in my project.
>
> What strikes me is that the linker tries to link to a
> `TagLib::FileName::Filename(unsigned short const *)` constructor whereas
> I'm using `const wchart_t *`. Everything works fine if I use `const char
> *`.

See the problem described here -
http://stackoverflow.com/questions/1520986/open-file-in-taglib-with-unicode-chars-in-filename/1526606#1526606

If this is with TagLib 1.7, then it's a known problem that TagLib is
compiled with the /Zc:wchar_t- option, which makes MSVC convert
wchar_t as unsigned short. Alternatively, check which flags are you
using to compile your application.

Lukas


More information about the taglib-devel mailing list