Reputation: 1207
I'm using tinyxml library for parsing XML files in my project. When I try to target x64 platforms I get LINKER errors and here is one fo them:
Error 4 error LNK2001: unresolved external symbol "private: static struct TiXmlString::Rep TiXmlString::nullrep_" (?nullrep_@TiXmlString@@0URep@1@A) ClassThatUsesTinyXML.obj
Update : I figured that the x64 version of tinyxml was not installed but when I tried to build the library for x64 platforms I got this error :
LNK1561: entry point must be defined
Upvotes: 8
Views: 5373
Reputation: 31
The errors occurs when you define TIXML_USE_STL for the compilation of the library, but not for the sources that link to the library. The end result is that the library is compiled with different code from the sources using the library.
Upvotes: 3
Reputation: 1207
Instead of building tinyxml for x64 platforms
and then adding tinyxml.h
and tinystr.h
to the project, I just added all the library files including the .cpp
files and now I can target x64 platforms, the library is, in fact, being built when I build the whole project.
Upvotes: 6
Reputation: 39218
It does not look like tinyxml supports shared library builds out of the box.
Here are the steps that I followed to build a DLL from the tinyxml 2.6.2 sources:
tinyxml.sln
, in MS Visual Studio Express 2012 for Windows Desktop. Elect to convert the old project files to the new format when prompted.Within tinyxml_2_6_2\tinyxml\x64\Release
you will find tinyxml.dll
, but no import library (tinyxml.lib
). This is because no symbols are exported. See How do I build an import library (.lib) AND a DLL in Visual C++?
If you want to go the shared library route, you will need to export the desired symbols via the MSVC-specific __declspec(dllexport)
modifier. See Symbol Visibility in Windows.
Upvotes: 3