Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

TiXmlText causes auto-import linker errors

(1/2) > >>

artoj:
Hello,

I'm using TiXmlText class (from TinyXML in C::B SDK) in my Code Snippets plugin but I've have problem with the linker creating auto-import errors. Using the TiXmlElement class for example does not create these errors.

A simple way to reproduce is to create new Code::Blocks plugin, include "<tinyxml/tinyxml.h>" and use the TiXmlText class somewhere.

The log:


--- Code: ---mingw32-g++.exe -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DTIXML_USE_STL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -g  -IC:\SVN\codeblocks\src\sdk -IC:\SVN\codeblocks\src\sdk\wxscintilla\include -IC:\wxWidgets-2.6.3\include -IC:\wxWidgets-2.6.3\lib\gcc_dll\mswu -IC:\MinGW\include  -c TestPlugin.cpp -o obj\Debug\TestPlugin.o
mingw32-g++.exe -shared   -Wl,--dll -LC:\SVN\codeblocks\src\devel -LC:\wxWidgets-2.6.3\lib\gcc_dll -LC:\MinGW\lib  obj\Debug\TestPlugin.o   -o .\TestPlugin.dll  -lcodeblocks -lwxmsw26u

Info: resolving vtable for TiXmlTextby linking to __imp___ZTV9TiXmlText (auto-import)
obj\Debug\TestPlugin.o(.text$_ZN9TiXmlTextD1Ev[TiXmlText::~TiXmlText()]+0xb): In function `ZNSt6vectorIPN14BlockAllocatorI21CodeBlocksLayoutEventLj75ELb0EE11LinkedBlockIS1_EESaIS5_EEixEj':
C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stl_vector.h: variable 'vtable for TiXmlText' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.

obj\Debug\TestPlugin.o(.text$_ZN9TiXmlTextC1EPKc[TiXmlText::TiXmlText(char const*)]+0x54):C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stl_vector.h: variable 'vtable for TiXmlText' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.

collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
0 errors, 0 warnings

--- End code ---

I'm using Windows XP x64 and mingw 5.0.3 (gcc 3.4.2) and the latest SVN version of Code::Blocks.

I can't reproduce it with Ubuntu Linux (Dapper), GCC 4.0.3, C::B revision 2820.

thomas:
Funny, you should not auto-import anything at all from TinyXML. Do you not have import libs?

artoj:

--- Quote from: thomas on August 09, 2006, 08:41:59 pm ---Funny, you should not auto-import anything at all from TinyXML. Do you not have import libs?

--- End quote ---

I link to libcodeblocks.a in the devel directory of Code::Blocks' source directory. The lib is built from revision 2831.

To be honest, I don't know what the error message even means. I read what the --enable-auto-import switch does from ld's man file but still I'm more than confused.

I can reprocude the error just writing 'TiXmlText textNode("test");' to a source file and compiling/linking. 'TiXmlElement elementNode("test");' works fine.

thomas:

--- Quote from: artoj on August 09, 2006, 09:37:30 pm ---To be honest, I don't know what the error message even means.
--- End quote ---
You normally only get that error under some specific condtions if you directly link to a DLL (without an import library).


--- Quote from: artoj on August 09, 2006, 09:37:30 pm ---I can reprocude the error just writing 'TiXmlText textNode("test");' to a source file and compiling/linking. 'TiXmlElement elementNode("test");' works fine.

--- End quote ---
I don't know what makes it fail for your plugin, but if you look at configmanager.cpp, line 992, you'll see that it does work fine for the main app. Hmm... no idea what to say really.  :?

Could it be some build flag that's different somewhere? Something like TIXML_USE_STL or such? Maybe the linker does not find the right function in the import lib for such a reason and then tries to get it from the DLL (which is, by accident, added to the project, too...?)

artoj:
I did some testing; there are other TiXml* classes that don't work too. The weird thing is that some of the classes work from the heap but refuse to work from stack (the same linker errors).

TiXmlDocument: stack - errors, heap - no errors
TiXmlComment: stack and heap - errors
TiXmlDeclaration: stack and heap - errors
TiXmlText: stack and heap - errors
TiXmlElement - stack and heap - no errors

I also deleted all the DLL files from the devel directory but the error messages remain.

*sigh* :(

Navigation

[0] Message Index

[#] Next page

Go to full version