I am trying to compile my program and am getting strange errors. I have looked for any sort of redefinition in Cocos2d-x and can't seem to find it. I am just at a loss for where to proceed and what these even mean.
1>libcocos2d.lib(libcocos2d.dll) : error LNK2005: "public: char const * __thiscall tinyxml2::XMLElement::GetText(void)const " (?GetText@XMLElement@tinyxml2@@QBEPBDXZ) already defined in tinyxml2.obj
1>libcocos2d.lib(libcocos2d.dll) : error LNK2005: "public: enum tinyxml2::XMLError __thiscall tinyxml2::XMLElement::QueryIntText(int *)const " (?QueryIntText@XMLElement@tinyxml2@@QBE?AW4XMLError@2@PAH@Z) already defined in tinyxml2.obj
1>libcocos2d.lib(libcocos2d.dll) : error LNK2005: "public: enum tinyxml2::XMLError __thiscall tinyxml2::XMLElement::QueryFloatText(float *)const " (?QueryFloatText@XMLElement@tinyxml2@@QBE?AW4XMLError@2@PAM@Z) already defined in tinyxml2.obj
1>libcocos2d.lib(libcocos2d.dll) : error LNK2005: "public: __thiscall tinyxml2::XMLDocument::XMLDocument(bool,enum tinyxml2::Whitespace)" (??0XMLDocument@tinyxml2@@QAE@_NW4Whitespace@1@@Z) already defined in tinyxml2.obj
1>libcocos2d.lib(libcocos2d.dll) : error LNK2005: "public: virtual __thiscall tinyxml2::XMLDocument::~XMLDocument(void)" (??1XMLDocument@tinyxml2@@UAE@XZ) already defined in tinyxml2.obj
1>libcocos2d.lib(libcocos2d.dll) : error LNK2005: "public: class tinyxml2::XMLNode * __thiscall tinyxml2::XMLNode::InsertFirstChild(class tinyxml2::XMLNode *)" (?InsertFirstChild@XMLNode@tinyxml2@@QAEPAV12@PAV12@@Z) already defined in tinyxml2.obj
1>libcocos2d.lib(libcocos2d.dll) : error LNK2005: "public: void __thiscall tinyxml2::XMLNode::DeleteChildren(void)" (?DeleteChildren@XMLNode@tinyxml2@@QAEXXZ) already defined in tinyxml2.obj
1>libcocos2d.lib(libcocos2d.dll) : error LNK2005: "public: enum tinyxml2::XMLError __thiscall tinyxml2::XMLDocument::LoadFile(char const *)" (?LoadFile@XMLDocument@tinyxml2@@QAE?AW4XMLError@2@PBD@Z) already defined in tinyxml2.obj
1>libcocos2d.lib(libcocos2d.dll) : error LNK2005: "public: enum tinyxml2::XMLError __thiscall tinyxml2::XMLDocument::SaveFile(char const *,bool)" (?SaveFile@XMLDocument@tinyxml2@@QAE?AW4XMLError@2@PBD_N@Z) already defined in tinyxml2.obj
1>libcocos2d.lib(libcocos2d.dll) : error LNK2005: "public: class tinyxml2::XMLElement * __thiscall tinyxml2::XMLDocument::NewElement(char const *)" (?NewElement@XMLDocument@tinyxml2@@QAEPAVXMLElement@2@PBD@Z) already defined in tinyxml2.obj
1>libcocos2d.lib(libcocos2d.dll) : error LNK2005: "public: class tinyxml2::XMLText * __thiscall tinyxml2::XMLDocument::NewText(char const *)" (?NewText@XMLDocument@tinyxml2@@QAEPAVXMLText@2@PBD@Z) already defined in tinyxml2.obj
Cocos2D-X already includes TinyXML. The error indicates that the TinyXML source files are being compiled twice. For example if cocos2d-x is a separate build target and you've added the TinyXML files to your app project target this error will occur due to the same symbols existing in two libraries/object files.
Solution: don't add TinyXML source files to your project, simply #include the headers of TinyXML as provided by cocos2d-x.