Compiling Error

Developer
godfor101
2008-12-21
2013-05-20
  • godfor101
    godfor101
    2008-12-21

    Hi

    I added the following files:
    tinyxml.cpp, tinyxml.h, tinyxmlerror.cpp, tinyxmlparser.cpp, tinystr.cpp, and tinystr.h

    to my project and tried to compile them but I get the error:
    undefined reference to `TiXmlNode::NextSiblingElement(char const*) const'
    in tinyxml.h on line 647.

    Please help!

    Thanks

     
    • Pavel Shuvalov
      Pavel Shuvalov
      2008-12-21

      Are you shure that you added object files maked from tinyXml source to final link operation?

       
  • Freeman Ang
    Freeman Ang
    2009-10-12

    Hi, Shuvalov and GodFor101,

    I know its been a year since this issue was resolved, but I am a user currently experiencing the exact same problem :

           
        /usr/bin/gmake -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
        gmake: Entering directory `/home/freeman/Desktop/SimpleXMLNodeReader'
        /usr/bin/gmake -f nbproject/Makefile-Debug.mk dist/Debug/GNU_1-Linux-x86/simplexmlnodereader
        gmake: Entering directory `/home/freeman/Desktop/SimpleXMLNodeReader'
        mkdir -p dist/Debug/GNU_1-Linux-x86
        g++ -I/usr/local/include/libxml2/libxml -o dist/Debug/GNU_1-Linux-x86/simplexmlnodereader build/Debug/GNU_1-Linux-x86/main.o -L/usr/include/libxml2
        build/Debug/GNU_1-Linux-x86/main.o: In function `dump_attribs_to_stdout(TiXmlElement*, unsigned int)':
        /home/freeman/Desktop/SimpleXMLNodeReader/main.cpp:45: undefined reference to `TiXmlAttribute::QueryIntValue(int*) const'
        /home/freeman/Desktop/SimpleXMLNodeReader/main.cpp:46: undefined reference to `TiXmlAttribute::QueryDoubleValue(double*) const'
        build/Debug/GNU_1-Linux-x86/main.o: In function `dump_to_stdout(char const*)':
        /home/freeman/Desktop/SimpleXMLNodeReader/main.cpp:113: undefined reference to `TiXmlDocument::TiXmlDocument(char const*)'
        /home/freeman/Desktop/SimpleXMLNodeReader/main.cpp:114: undefined reference to `TiXmlDocument::LoadFile(TiXmlEncoding)'
        build/Debug/GNU_1-Linux-x86/main.o: In function `main':
        /home/freeman/Desktop/SimpleXMLNodeReader/main.cpp:133: undefined reference to `TiXmlDocument::TiXmlDocument(char const*)'
        /home/freeman/Desktop/SimpleXMLNodeReader/main.cpp:134: undefined reference to `TiXmlDocument::LoadFile(TiXmlEncoding)'
        build/Debug/GNU_1-Linux-x86/main.o: In function `TiXmlString::quit()':
        /home/freeman/Desktop/SimpleXMLNodeReader/tinystr.h:255: undefined reference to `TiXmlString::nullrep_'
        build/Debug/GNU_1-Linux-x86/main.o: In function `TiXmlAttribute::Next()':
        /home/freeman/Desktop/SimpleXMLNodeReader/tinyxml.h:869: undefined reference to `TiXmlAttribute::Next() const'
        build/Debug/GNU_1-Linux-x86/main.o: In function `~TiXmlDocument':
        /home/freeman/Desktop/SimpleXMLNodeReader/tinyxml.h:1482: undefined reference to `vtable for TiXmlDocument'
        /home/freeman/Desktop/SimpleXMLNodeReader/tinyxml.h:1482: undefined reference to `TiXmlNode::~TiXmlNode()'
        collect2: ld returned 1 exit status
        gmake: ***  Error 1
        gmake: Leaving directory `/home/freeman/Desktop/SimpleXMLNodeReader'
        gmake: ***  Error 2
        gmake: Leaving directory `/home/freeman/Desktop/SimpleXMLNodeReader'
        gmake: ***  Error 2
        BUILD FAILED (exit value 2, total time: 245ms)

    Can you provide some guidance on how do I add object files maked from tinyXML source to final link operation?

    Thank you so much for your help!!