Sign in to follow this  
Mybowlcut

TinyXML++ link errors

Recommended Posts

Hey. I've got a static library that uses TinyXML++ source code. I put the include directory for TinyXML++ in the library's additional include directories and did the same in my project that tests the library code. I compiled the library with no problems, and then compiled the project that tests the library and I got link errors. So, I added the source files into the testing project as an existing item and tried again. I still got the link errors. So I went as far as to add the source files into the library as existing items AND put #include "stdafx.h" statements in the TinyXML++ .cpp files and tried again... but still got link errors. So I'm wondering what I'm doing wrong? These are the link errors:
Quote:
Error 2 error LNK2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall ticpp::Element::GetAttribute(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?GetAttribute@Element@ticpp@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV34@@Z) referenced in function "private: void __thiscall Level::Read_Tiles(class ticpp::Element *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class Tile,class std::allocator<class Tile> > &)" (?Read_Tiles@Level@@AAEXPAVElement@ticpp@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$vector@VTile@@V?$allocator@VTile@@@std@@@5@@Z) SDL_Game_Engine.lib Error 3 error LNK2019: unresolved external symbol "public: class ticpp::Element * __thiscall ticpp::Node::NextSiblingElement(bool)const " (?NextSiblingElement@Node@ticpp@@QBEPAVElement@2@_N@Z) referenced in function "private: void __thiscall Level::Read_Tiles(class ticpp::Element *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class Tile,class std::allocator<class Tile> > &)" (?Read_Tiles@Level@@AAEXPAVElement@ticpp@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$vector@VTile@@V?$allocator@VTile@@@std@@@5@@Z) SDL_Game_Engine.lib Error 4 error LNK2019: unresolved external symbol "public: class ticpp::Element * __thiscall ticpp::Node::FirstChildElement(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool)const " (?FirstChildElement@Node@ticpp@@QBEPAVElement@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z) referenced in function "private: void __thiscall Level::Read_Tiles(class ticpp::Element *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class Tile,class std::allocator<class Tile> > &)" (?Read_Tiles@Level@@AAEXPAVElement@ticpp@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$vector@VTile@@V?$allocator@VTile@@@std@@@5@@Z) SDL_Game_Engine.lib Error 5 error LNK2019: unresolved external symbol "public: class ticpp::Element * __thiscall ticpp::Node::FirstChildElement(char const *,bool)const " (?FirstChildElement@Node@ticpp@@QBEPAVElement@2@PBD_N@Z) referenced in function "private: void __thiscall Level::Read_Object_Tiles(class ticpp::Element *)" (?Read_Object_Tiles@Level@@AAEXPAVElement@ticpp@@@Z) SDL_Game_Engine.lib Error 6 error LNK2019: unresolved external symbol "public: void __thiscall ticpp::Document::LoadFile(enum TiXmlEncoding)" (?LoadFile@Document@ticpp@@QAEXW4TiXmlEncoding@@@Z) referenced in function "public: virtual void __thiscall Level::Read(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Read@Level@@UAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) SDL_Game_Engine.lib Error 7 error LNK2019: unresolved external symbol "public: __thiscall ticpp::Document::Document(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Document@ticpp@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: virtual void __thiscall Level::Read(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Read@Level@@UAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) SDL_Game_Engine.lib Error 8 error LNK2019: unresolved external symbol "public: __thiscall ticpp::Element::Element(char const *)" (??0Element@ticpp@@QAE@PBD@Z) referenced in function "private: void __thiscall Level::Write_Tiles(class ticpp::Element *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class Tile,class std::allocator<class Tile> > &)" (?Write_Tiles@Level@@AAEXPAVElement@ticpp@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$vector@VTile@@V?$allocator@VTile@@@std@@@5@@Z) SDL_Game_Engine.lib Error 9 error LNK2019: unresolved external symbol "public: class ticpp::Node * __thiscall ticpp::Node::LinkEndChild(class ticpp::Node *)" (?LinkEndChild@Node@ticpp@@QAEPAV12@PAV12@@Z) referenced in function "private: void __thiscall Level::Write_Tiles(class ticpp::Element *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class Tile,class std::allocator<class Tile> > &)" (?Write_Tiles@Level@@AAEXPAVElement@ticpp@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$vector@VTile@@V?$allocator@VTile@@@std@@@5@@Z) SDL_Game_Engine.lib Error 10 error LNK2019: unresolved external symbol "public: __thiscall ticpp::Element::Element(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Element@ticpp@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "private: void __thiscall Level::Write_Tiles(class ticpp::Element *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class Tile,class std::allocator<class Tile> > &)" (?Write_Tiles@Level@@AAEXPAVElement@ticpp@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$vector@VTile@@V?$allocator@VTile@@@std@@@5@@Z) SDL_Game_Engine.lib Error 11 error LNK2019: unresolved external symbol "public: __thiscall ticpp::Declaration::Declaration(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Declaration@ticpp@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z) referenced in function "public: virtual void __thiscall Level::Write(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Write@Level@@UAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) SDL_Game_Engine.lib Error 12 error LNK2019: unresolved external symbol "public: __thiscall ticpp::Document::Document(void)" (??0Document@ticpp@@QAE@XZ) referenced in function "public: virtual void __thiscall Level::Write(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Write@Level@@UAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) SDL_Game_Engine.lib Error 13 error LNK2019: unresolved external symbol "public: void __thiscall TiCppRCImp::DecRef(void)" (?DecRef@TiCppRCImp@@QAEXXZ) referenced in function "public: virtual __thiscall ticpp::NodeImp<class TiXmlDocument>::~NodeImp<class TiXmlDocument>(void)" (??1?$NodeImp@VTiXmlDocument@@@ticpp@@UAE@XZ) SDL_Game_Engine.lib Error 14 error LNK2019: unresolved external symbol "public: __thiscall ticpp::Exception::Exception(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Exception@ticpp@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: virtual void __thiscall ticpp::Node::IterateFirst(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class ticpp::Attribute * *)const " (?IterateFirst@Node@ticpp@@UBEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAPAVAttribute@2@@Z) SDL_Game_Engine.lib Error 15 error LNK2001: unresolved external symbol "public: virtual __thiscall ticpp::Exception::~Exception(void)" (??1Exception@ticpp@@UAE@XZ) SDL_Game_Engine.lib Error 16 error LNK2001: unresolved external symbol "public: virtual char const * __thiscall ticpp::Exception::what(void)const " (?what@Exception@ticpp@@UBEPBDXZ) SDL_Game_Engine.lib Error 17 error LNK2019: unresolved external symbol "public: bool __thiscall TiCppRCImp::IsNull(void)" (?IsNull@TiCppRCImp@@QAE_NXZ) referenced in function "protected: void __thiscall ticpp::Base::ValidatePointer(void)const " (?ValidatePointer@Base@ticpp@@IBEXXZ) SDL_Game_Engine.lib Error 18 error LNK2019: unresolved external symbol "public: void __thiscall TiCppRCImp::IncRef(void)" (?IncRef@TiCppRCImp@@QAEXXZ) referenced in function "protected: virtual void __thiscall ticpp::NodeImp<class TiXmlDocument>::operator=(class ticpp::NodeImp<class TiXmlDocument> const &)" (??4?$NodeImp@VTiXmlDocument@@@ticpp@@MAEXABV01@@Z) SDL_Game_Engine.lib Error 19 error LNK2019: unresolved external symbol "private: bool __thiscall ticpp::Element::GetAttributeImp(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)const " (?GetAttributeImp@Element@ticpp@@ABE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAV34@@Z) referenced in function "public: int __thiscall ticpp::Element::GetAttribute<int>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool)const " (??$GetAttribute@H@Element@ticpp@@QBEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z) SDL_Game_Engine.lib Error 20 error LNK2019: unresolved external symbol "public: void __thiscall TiXmlElement::SetAttribute(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?SetAttribute@TiXmlElement@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) referenced in function "public: void __thiscall ticpp::Element::SetAttribute<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??$SetAttribute@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Element@ticpp@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) SDL_Game_Engine.lib Error 21 fatal error LNK1120: 19 unresolved externals C:\Documents and Settings\Bill\My Documents\Visual Studio 2005\Projects\SDL_Testing\Debug\SDL_Testing.exe
Cheers.

Share this post


Link to post
Share on other sites
My copy of TinyXML came with an xmltest.cpp. Try making a new empty console project and adding xmltest.cpp, tinystr.cpp, tinyxml.cpp, tinyxmlerror.cpp and tinyxmlparser.cpp to your source directory in solution explorer, and tinyxml.h to your header directory in solution explorer and see if it will compile.

Share this post


Link to post
Share on other sites
Quote:
Original post by Cantos
My copy of TinyXML came with an xmltest.cpp. Try making a new empty console project and adding xmltest.cpp, tinystr.cpp, tinyxml.cpp, tinyxmlerror.cpp and tinyxmlparser.cpp to your source directory in solution explorer, and tinyxml.h to your header directory in solution explorer and see if it will compile.


I don't have that file and can't see it on google code. Pretty sure that's tinyxml not tinyxml++.

[Edited by - Mybowlcut on November 22, 2008 7:22:33 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by sprite_hound
I think you might need to put #define TIXML_USE_TICPP before you #include tinyxml++ if you haven't already.
Hey. Cheers for the reply.

Yeah, I've already chucked that in:
/*
Universal class. Edits affect multiple projects.
*/


#ifndef USE_TICPP_H
#define USE_TICPP_H

// Wrapper to neaten up #defs below.

#ifndef TIXML_USE_TICPP
#define TIXML_USE_TICPP
#endif

#ifndef TIXML_USE_STL
#define TIXML_USE_STL
#endif

#include "ticpp.h"

#endif
The project I'm testing the library with doesn't include TinyXML at all, it's just the static library that uses it and the testing project includes the static library files.

Share this post


Link to post
Share on other sites
I simplified the problem and posted it to source forge hoping that posting it on the project's forums would get a response but it's dead over there... so if anyone could have a look at my post there and see if they can see what's wrong, that'd be great.

Cheers.

Share this post


Link to post
Share on other sites
Hi!

I had the same problem.
Re-generating the solution file for ticpp using
 premake.exe --target vs2005 --unicode --dynamic-runtime 
and of course recompiling it, solved the issue for me.

Cheers,
Greg

Share this post


Link to post
Share on other sites
OMFG... Premake had set it up so that the output directory where the .lib files were written to was UP a directory from the directory tinyxml++ had been installed... wtf is the point of that? :@

Fixed... changed output directory to lib instead of ../lib

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this