Menu

unresoleved external

zeugma
2005-03-04
2013-05-20
  • zeugma

    zeugma - 2005-03-04

    i have a simple program with the following code:

    #include <tinyxml.h>

    int main() {
        TiXmlDocument xmlfile("test.xml");
        xmlfile.LoadFile();

        return 0;
    }

    but when i compile it, i get an unresolved external symbol error:

    xml-test error LNK2001: unresolved external symbol "protected: virtual void __thiscall TiXmlDocument::StreamOut(class TiXmlOutStream *)const " (?StreamOut@TiXmlDocument@@MBEXPAVTiXmlOutStream@@@Z)

    i just got it today so it's the latest version, i'm using vc7, and i'm linking to tinyxml_stl.lib

    what am i missing here?

     
    • zeugma

      zeugma - 2005-03-05

      okay, i realized i hadn't added those files like i was supposed to. now it all works. (yeah, i feel stupid)

       
    • Daniel (sir) Szot

      I have same problem. Which files I must add that this will be work.

      Sorry, my English.

       
    • Ellers

      Ellers - 2005-03-21

      It depends on a lot of things (platform, compiler, what have you added already), but assuming you're using msvc 6 on Windows you need to add one of these to the link list:

        tinyxmld.lib (debug)
      or
        tinyxml.lib  (release)

       
    • Daniel (sir) Szot

      I must have added inyxmld.lib and inyxmld_STL.lib?

       
    • Ellers

      Ellers - 2005-03-21

      Choose whichever one is appropriate.

      Choices:
      - did you build debug and with no STL: use tinyxmld.lib (there is a "t" on the front; it is not "inyxml.lib")
      - did you build debug and WITH STL?: use tinyxmld_STL.lib
      - did you build release WITH STL?: use tinyxml_STL.lib

      etc

      You might want to check out some intro C++ tutorials because this is very beginner stuff, not related to TinyXML itself.

       
    • Daniel (sir) Szot

      Yes, yes, but if i add only tinyxml_STL i have this error, but if I add tinyxml all its ok. But i want use tinyxml with STL

       
    • Ellers

      Ellers - 2005-03-22

      So you're asking "How do I build TinyXML for STL" ?

      From the readme.txt file:

      """Use the compile time #define:

          TIXML_USE_STL
      """

       
    • Ellers

      Ellers - 2005-03-22

      Also, in your program (not the library) be sure to set TIXML_USE_STL when compiling. When the compiler processes #includes it is important that the variable is defined the same way as when the library was compiled.

       
    • Lee Thomason

      Lee Thomason - 2005-03-22

      Also, I'd recommend you don't use the libs. TinyXml is very simple at 6 files - just add them to your parent project and compile it in.

      lee

       
      • Ellers

        Ellers - 2005-03-22

        Good point :)

         
    • Daniel (sir) Szot

      Now, all its ok. Thanks for help :)

       

Log in to post a comment.