Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Problem using TiXml inside Plugin

(1/2) > >>

byo:
Hi, when I want to use TiXml inside my plugin but I;ve got following linker errors:


--- Quote ---Info: resolving vtable for TiXmlDocumentby linking to __imp___ZTV13TiXmlDocument (auto-import)
.objs\wxsproject.o(.text$_ZN13TiXmlDocumentD1Ev[TiXmlDocument::~TiXmlDocument()]+0x3a): In function `ZSt24__uninitialized_copy_auxIN9__gnu_cxx17__normal_iteratorIP8wxStringSt6vectorIS2_SaIS2_EEEES7_ET0_T_S9_S8_12__false_type':
C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/ext/new_allocator.h: variable 'vtable for TiXmlDocument' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
collect2: ld returned 1 exit status
--- End quote ---


After adding tixml.a into project I've got:


--- Quote ---D:\CodeBlocks\cb_2_6\codeblocks\src\sdk\tinyxml\libtxml.a(tinyxml.o)(.text+0x136e): In function `ZNK9TiXmlNode18NextSiblingElementEv':
D:/CodeBlocks/cb_2_6/codeblocks/src/sdk/tinyxml/tinyxml.cpp:410: multiple definition of `TiXmlNode::NextSiblingElement() const'
D:\CodeBlocks\cb_2_6\codeblocks\src\devel/libcodeblocks.a(d002332.o)(.text+0x0): first defined here
D:\CodeBlocks\cb_2_6\codeblocks\src\sdk\tinyxml\libtxml.a(tinyxml.o)(.text+0x256a): In function `ZN13TiXmlDocumentC1EPKc':
D:/CodeBlocks/cb_2_6/codeblocks/src/sdk/tinyxml/tinyxml.cpp:670: multiple definition of `TiXmlDocument::TiXmlDocument(char const*)'
D:\CodeBlocks\cb_2_6\codeblocks\src\devel/libcodeblocks.a(d000675.o)(.text+0x0): first defined here
D:\CodeBlocks\cb_2_6\codeblocks\src\sdk\tinyxml\libtxml.a(tinyxml.o)(.text+0x2678): In function `ZN13TiXmlDocument8LoadFileEv':
D:/CodeBlocks/cb_2_6/codeblocks/src/sdk/tinyxml/tinyxml.cpp:678: multiple definition of `TiXmlDocument::LoadFile()'
D:\CodeBlocks\cb_2_6\codeblocks\src\devel/libcodeblocks.a(d000673.o)(.text+0x0): first defined here
D:\CodeBlocks\cb_2_6\codeblocks\src\sdk\tinyxml\libtxml.a(tinyxml.o)(.text+0x12b4): In function `ZNK9TiXmlNode17FirstChildElementEv':
D:/CodeBlocks/cb_2_6/codeblocks/src/sdk/tinyxml/tinyxml.cpp:381: multiple definition of `TiXmlNode::FirstChildElement() const'
D:\CodeBlocks\cb_2_6\codeblocks\src\devel/libcodeblocks.a(d002330.o)(.text+0x0): first defined here
D:\CodeBlocks\cb_2_6\codeblocks\src\sdk\tinyxml\libtxml.a(tinyxml.o)(.text+0x4c4): In function `ZN9TiXmlNodeD2Ev':
D:/CodeBlocks/cb_2_6/codeblocks/src/sdk/tinyxml/tinyxml.cpp:140: multiple definition of `TiXmlNode::~TiXmlNode()'
D:\CodeBlocks\cb_2_6\codeblocks\src\devel/libcodeblocks.a(d001903.o)(.text+0x0): first defined here
collect2: ld returned 1 exit status

--- End quote ---


I guess that TiXml has been linked into codeblocks library. But how can I use this ? (I got MinGW 3.2 with Msys 1.0.10)

rickg22:
You might try reading the C::B code and copy some of the code used. Maybe it got some defines or DLLIMPORT definitions in there.

byo:
Hmm, I'm using TiXml directly from C::B sdk, maybe there's something missing. I will try to find the solution (just need to find some free time  :? ).
Maybe if someone has solved this yet and would be able to help me. I would appreciate that  :D

byo:
I've found the solution for this problem :D.
TiXml classes should be compiled with DLLIMPORT (I've made it by including "../settings.h" file, adding DLLIMPORT for each class in main headers and also copying all compiler definitions from sdk to TiXml target).
It's working but with modified version of TiXml. But I think it shuoldn't be a big problem - only few lines of code need modification.

DreadNot:
Try this instead of changing the code:
1. Add "txml" to the library list and place it before the codeblocks library.
2. Add the "txml" dir (...\sdk\tinyxml) to the library dirs (I placed it first, but don't think it matters).

For some reason, when the make for the SDK DLL creates the static lib ("Create static library too" is checked), it doesn't link in libtxml.a in its original form.  Any ideas?

Navigation

[0] Message Index

[#] Next page

Go to full version