Using taglib with Visual Studio 2017

jon bird news at onasticksoftware.co.uk
Sun Oct 14 17:07:46 BST 2018


> I'm attempting to use TagLib with Visual Studio 2017, and I'm having some
> difficulties getting the examples to work, specifically with respect to
> linker errors.  Here is a summary of what I've done so far:
>
[...]
I'm using VS2013 for my project but I imagine the settings etc. should be
near enough identical.

> main() function.  Initially, I don't see any compilation errors in Visual
> Studio, however when I do a full build on retag4, I get two C4251 warnings
> with the message:
>
> 'TagLib::FileName::m_name': class
> 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
> needs
> to have dll-interface to be used by clients of class 'TagLib::FileName'
>
> 'TagLib::FileName::m_wname': class
> 'std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>'
> needs to have dll-interface to be used by clients of class
> 'TagLib::FileName'
>
Think these can be safely ignored, I get them & they don't seem to be
causing any problems. Exporting C++ from DLLs seems to be a black art & I
suspect these are classes used internally by taglib which (because they've
not been explicitly exported) can't be used by applications outside the
DLL.

> There are also a series of LNK2019 errors with verbiage like this:
>
> unresolved external symbol "__declspec(dllimport) public: virtual
> __thiscall TagLib::String::~String(void)" (__imp_??1String at TagLib@@UAE at XZ)
> referenced in function _main
>

I link to taglib dynamically, looking at the settings I've pretty much got
what you have in terms of compiler, linker options. There's no additional
preprocessor definitions I've needed to add to get it to work. The Visual
Studio projects CMake produces should be able to generate the DLLs without
any problems. At a guess (since I've never seen this) it sounds like might
be related to using a static library.

Rgs,

Jon.




More information about the taglib-devel mailing list