While compiling C::B with MinGW-w64, I got this error:
~~~
CXXLD libcodecompletion.la
.libs/parsemanager.o:parsemanager.cpp:(.text+0x1055d): undefined reference to TiXmlNode::FirstChildElement(char const*) const'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x1058b): undefined reference toTiXmlNode::FirstChildElement(char const) const'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x105af): undefined reference to TiXmlElement::Attribute(char const*) const'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x105c3): undefined reference toTiXmlElement::Attribute(char const) const'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x106cf): undefined reference to TiXmlNode::NextSiblingElement(char const*) const'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x1795e): undefined reference toTiXmlNode::FirstChildElement(char const) const'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x17976): undefined reference to TiXmlElement::TiXmlElement(char const*)'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x17981): undefined reference toTiXmlNode::InsertEndChild(TiXmlNode const&)'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x17995): undefined reference to TiXmlElement::~TiXmlElement()'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x179a6): undefined reference toTiXmlNode::Clear()'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x179d7): undefined reference to TiXmlElement::TiXmlElement(char const*)'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x179e2): undefined reference toTiXmlNode::InsertEndChild(TiXmlNode const&)'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x179f6): undefined reference to TiXmlElement::~TiXmlElement()'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x17a21): undefined reference toTiXmlElement::SetAttribute(char const, char const*)'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x17a8f): undefined reference to TiXmlElement::~TiXmlElement()'
.libs/parsemanager.o:parsemanager.cpp:(.text+0x17aa2): undefined reference toTiXmlElement::~TiXmlElement()'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:686: libcodecompletion.la] Error 1
make[4]: uscita dalla directory «/home/carlo/codeblocks/codeblocks-win64/src/plugins/codecompletion»
make[3]: *** [Makefile:761: all-recursive] Error 1
make[3]: uscita dalla directory «/home/carlo/codeblocks/codeblocks-win64/src/plugins/codecompletion»
make[2]: *** [Makefile:537: all-recursive] Error 1
make[2]: uscita dalla directory «/home/carlo/codeblocks/codeblocks-win64/src/plugins»
make[1]: *** [Makefile:544: all-recursive] Error 1
make[1]: uscita dalla directory «/home/carlo/codeblocks/codeblocks-win64/src»
make: *** [Makefile:675: all-recursive] Error 1
The linking of the `libcodecompletion.la` fails because tinyxml is missing in the flags for the linker.
However, this seems to be wanted, because into this file:
`codeblocks-code/src/plugins/codecompletion/Makefile.am`
I can see this code:
if ! CODEBLOCKS_NT
libcodecompletion_la_LIBADD += $(CB_TINYXML_LIBS)
endif
~~~
So, $(CB_TINYXML_LIBS) is never added to LIBADDwhen CODEBLOCKS_NT and this is why it doesn't work.
Is there a particular reason because this has been done?
Otherwise, it seems I cannot build C::B.
Thank you very much.
Can you edit plugins/codecompletion/Makefile.am:11
adding
-Wl,--enable-auto-importat the end?I don't think that this is the solution of the problem.
If you look into configure.ac, you will see this:
As you can see, this code checks the presence of tinyxml with pkg-config and it sets
HAVE_TINYXMLaccording to the detection.The
AM_CONDITIONALalso sets theHAVE_TINYXML_TRUE.Further down, there is this code:
If tinyxml was found, then
CB_TINYXML_CFLAGSandCB_TINYXML_LIBSkeep the values found by pkg-config. Otherwise, they are set to the local copy of tinyxml into the source tree of C::B, located intosrc/base/tinyxml.So, the test on
CODEBLOCKS_NTintoplugins/codecompletion/Makefile.amcompletely breaks this Autotools design by skippingCB_TINYXML_LIBSon Windows, which causes the undefined references to tinyxml symbols during linking.Removing that "if" statement around
libcodecompletion_la_LIBADDallows codecompletion to link properly on Windows in both conditions, without requiring workarounds like-Wl,--enable-auto-import.The codecompletion plugin is not the only one affected by this bug.
There are many other objects that cannot be compiled anymore on Windows for the exact same reason, as you can see by checking the Makefile.am files.