Unresolved external symbols when linking.

AntonyCoder

01-04-2006 21:11:27

I'm trying to integerate oFusion's scene loader into my ogre app and it's not going well.

It compiles perfectly but at the linker stage I get this,


------------- Build: Debug in iiii ---------------
main.cpp
c:\codeblocks\iiii\main.cpp(1161) : warning C4715: 'Render3D' : not all control paths return a value
Linking dynamic library: Debug\OgreMax.dll
Creating library Debug\OgreMax.lib and object Debug\OgreMax.exp
main.obj : error LNK2019: unresolved external symbol "public: __thiscall OSMScene::~OSMScene(void)" (??1OSMScene@@QAE@XZ) referenced in function _LoadScene@4
main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall OSMScene::createScene(class Ogre::SceneNode *)" (?createScene@OSMScene@@QAE_NPAVSceneNode@Ogre@@@Z) referenced in function _LoadScene@4
main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall OSMScene::initialise(char const *,class OSMSceneCallbacks *)" (?initialise@OSMScene@@QAE_NPBDPAVOSMSceneCallbacks@@@Z) referenced in function _LoadScene@4
main.obj : error LNK2019: unresolved external symbol "public: __thiscall OSMScene::OSMScene(class Ogre::SceneManager *,class Ogre::RenderWindow *)" (??0OSMScene@@QAE@PAVSceneManager@Ogre@@PAVRenderWindow@2@@Z) referenced in function _LoadScene@4
Debug\OgreMax.dll : fatal error LNK1120: 4 unresolved externals
Process terminated with status 1120 (0 minutes, 44 seconds)
5 errors, 1 warnings



Here's my sceneloader code from the app,

class oSceneCallback : public OSMSceneCallbacks {
public:


};

DLL void _stdcall LoadScene( const char *file)
{
OSMScene oScene;
oSceneCallback oe_Callback;
oScene.initialise(file, &oe_Callback);
oScene.createScene();
sceneMan = oScene.getSceneManager();
}

Evak

01-04-2006 21:40:01

BTW this is with the Dagon build of Ogre for VC++ 7.1 and the current Ofusion Scene loader for Dagon in the downloads page.

Lioric

02-04-2006 00:09:02

From the "Scene Loader/Integrating in your application" chapter of the User's guide

To integrate the oScene loader library in your application you need to include the 'OgreOSMScene.cpp' and the TinyXML source files in your project/solution.

AntonyCoder

02-04-2006 00:28:08

I added the tinyxml dir to my includes, that should be enough, it's all the demo app does.

And more to the point, it compiles without error, it just doesn't link. How will adding tinyxml source clear up osceneloader unresolved symbols?

I'll give it a go to be sure anyway.

Evak

02-04-2006 01:28:41

Didn't seem to work. Unfortunately I'm not familiar with C++, so I can't really help Antony on that front, I'm mostly doing the art side of things.

Lioric

02-04-2006 02:44:48

Is the OgreOSMScene.cpp (not the header ".h" file but the compilation unit ".cpp") included in your solution, is it being compiled when you build your project?

AntonyCoder

02-04-2006 09:05:53

No it's not, just to be clear here are the steps I took in order.

1. Copied Src/Include/TinyXMl folders into my project dir.

2.Open Build options, added all three folders to include dir.

3. Included OScene.H (I forget the name, sorry), NOt cpp.

So do I have to add oscene.cpp to my project so it's built? I think I get the problem now.

Thanks dude.

AntonyCoder

02-04-2006 09:15:39

OK, so I added OGreScene.cpp to the project, this resolved the errors repored above, but then threw up some errors concerning tinyxml.

So I added tinyxml to be build to, and this is what I get,

Linking dynamic library: Debug\OgreMax.dll
Creating library Debug\OgreMax.lib and object Debug\OgreMax.exp
tinyxml.obj : error LNK2001: unresolved external symbol "private: static struct TiXmlBase::Entity * TiXmlBase::entity" (?entity@TiXmlBase@@0PAUEntity@1@A)
tinyxml.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall TiXmlElement::StreamIn(class std::basic_istream<char,struct std::char_traits<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?StreamIn@TiXmlElement@@MAEXPAV?$basic_istream@DU?$char_traits@D@std@@@std@@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)
tinyxml.obj : error LNK2001: unresolved external symbol "protected: virtual char const * __thiscall TiXmlElement::Parse(char const *)" (?Parse@TiXmlElement@@MAEPBDPBD@Z)
tinyxml.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall TiXmlAttribute::Parse(char const *)" (?Parse@TiXmlAttribute@@UAEPBDPBD@Z)
tinyxml.obj : error LNK2001: unresolved external symbol "protected: static char const * * TiXmlBase::errorString" (?errorString@TiXmlBase@@1PAPBDA)
tinyxml.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall TiXmlDocument::StreamIn(class std::basic_istream<char,struct std::char_traits<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?StreamIn@TiXmlDocument@@MAEXPAV?$basic_istream@DU?$char_traits@D@std@@@std@@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)
tinyxml.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall TiXmlDocument::Parse(char const *)" (?Parse@TiXmlDocument@@UAEPBDPBD@Z)
tinyxml.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall TiXmlComment::StreamIn(class std::basic_istream<char,struct std::char_traits<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?StreamIn@TiXmlComment@@MAEXPAV?$basic_istream@DU?$char_traits@D@std@@@std@@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)
tinyxml.obj : error LNK2001: unresolved external symbol "protected: virtual char const * __thiscall TiXmlComment::Parse(char const *)" (?Parse@TiXmlComment@@MAEPBDPBD@Z)
tinyxml.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall TiXmlText::StreamIn(class std::basic_istream<char,struct std::char_traits<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?StreamIn@TiXmlText@@MAEXPAV?$basic_istream@DU?$char_traits@D@std@@@std@@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)
tinyxml.obj : error LNK2001: unresolved external symbol "protected: virtual char const * __thiscall TiXmlText::Parse(char const *)" (?Parse@TiXmlText@@MAEPBDPBD@Z)
tinyxml.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall TiXmlDeclaration::StreamIn(class std::basic_istream<char,struct std::char_traits<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?StreamIn@TiXmlDeclaration@@MAEXPAV?$basic_istream@DU?$char_traits@D@std@@@std@@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)
tinyxml.obj : error LNK2001: unresolved external symbol "protected: virtual char const * __thiscall TiXmlDeclaration::Parse(char const *)" (?Parse@TiXmlDeclaration@@MAEPBDPBD@Z)
tinyxml.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall TiXmlUnknown::StreamIn(class std::basic_istream<char,struct std::char_traits<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?StreamIn@TiXmlUnknown@@MAEXPAV?$basic_istream@DU?$char_traits@D@std@@@std@@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)
tinyxml.obj : error LNK2001: unresolved external symbol "protected: virtual char const * __thiscall TiXmlUnknown::Parse(char const *)" (?Parse@TiXmlUnknown@@MAEPBDPBD@Z)
libcpd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
libcpd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
Debug\OgreMax.dll : fatal error LNK1120: 17 unresolved externals
Process terminated with status 1120 (0 minutes, 21 seconds)
18 errors, 0 warnings

Any ideas what file I'm missing? I'll go check the demo see if that has a project file I can copy from.

AntonyCoder

02-04-2006 09:20:09

I added the other tinyxml cpp files and I've managed to reduce it to two unresolved symbols.

-------------- Build: Debug in iiii ---------------
tinyxmlerror.cpp
tinyxmlparser.cpp
tinystr.cpp
Linking dynamic library: Debug\OgreMax.dll
Creating library Debug\OgreMax.lib and object Debug\OgreMax.exp
libcpd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
libcpd.lib(_tolower.obj) : error LNK2001: unresolved external symbol __malloc_dbg
libcpd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
Debug\OgreMax.dll : fatal error LNK1120: 2 unresolved externals
Process terminated with status 1120 (0 minutes, 33 seconds)
4 errors, 0 warnings

wolfmanfx

02-04-2006 10:15:10

Set in the Options in VS to ignore these lib libcpd then it will work :)

AntonyCoder

02-04-2006 12:50:18

Really? Thanks. Can you tell me how to ignore the lib? I'm using vc2003 toolkit with code::blocks.
Never had to ignore a library before so I'm not sure what to do.

AntonyCoder

02-04-2006 13:03:45

Did some reading up and it appears ignore library is a page in the vc build options where you can specify graphically what libraries you wish to ignore.
I just checked Code::Blocks and it has no such option. But it does have a part where I can enter linker options textually. Do you know the actual command I have to pass?

I.e something like

/Ignore libcpd.lib

(And if it's that exactly I'll kick myself.)

AntonyCoder

02-04-2006 15:33:05

So I managed to ignore the library using /NODEFAULTLIB:libcpd.lib

but doing so means ogre no longer builds. I tried it without the ofusion stuff, just the app on it's own and refuses to build.

Here's the errors.

-------------- Build: Debug in iiii ---------------
Linking dynamic library: Debug\OgreMax.dll
Creating library Debug\OgreMax.lib and object Debug\OgreMax.exp
OgreNewt_Main_d.lib(OgreNewt_BasicFrameListener.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
OgreNewt_Main_d.lib(OgreNewt_RayCast.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
OgreNewt_Main_d.lib(OgreNewt_Debugger.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
OgreNewt_Main_d.lib(Line3D.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
tinyxml.obj : error LNK2019: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::append(char const *,unsigned int)" (?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z)
tinyxmlparser.obj : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
main.obj : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
OgreOSMScene.obj : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
OgreNewt_Main_d.lib(OgreNewt_BasicFrameListener.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
OgreNewt_Main_d.lib(OgreNewt_RayCast.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
OgreNewt_Main_d.lib(OgreNewt_Debugger.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
OgreNewt_Main_d.lib(Line3D.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
tinyxml.obj : error LNK2019: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::append(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,unsigned int)" (?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z)
tinyxmlparser.obj : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
main.obj : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
OgreOSMScene.obj : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
tinyxml.obj : error LNK2019: unresolved external symbol "public: void __thiscall std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z) referenced in function "public: void __thiscall std::basic_ios<char,struct std::char_traits<char> >::clear(int,bool)" (?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z)
tinyxmlparser.obj : error LNK2001: unresolved external symbol "public: void __thiscall std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z)
tinyxml.obj : error LNK2019: unresolved external symbol "bool __cdecl std::uncaught_exception(void)" (?uncaught_exception@std@@YA_NXZ) referenced in function "public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::sentry::~sentry(void)" (??1sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@XZ)
tinyxmlparser.obj : error LNK2019: unresolved external symbol "public: void __thiscall std::locale::facet::_Register(void)" (?_Register@facet@locale@std@@QAEXXZ) referenced in function "class std::ctype<char> const & __cdecl std::use_facet<class std::ctype<char> >(class std::locale const &)" (??$use_facet@V?$ctype@D@std@@@std@@YAABV?$ctype@D@0@ABVlocale@0@@Z)
tinyxmlparser.obj : error LNK2019: unresolved external symbol "public: class std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned int)const " (?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z) referenced in function "class std::ctype<char> const & __cdecl std::use_facet<class std::ctype<char> >(class std::locale const &)" (??$use_facet@V?$ctype@D@std@@@std@@YAABV?$ctype@D@0@ABVlocale@0@@Z)
tinyxmlparser.obj : error LNK2001: unresolved external symbol "public: static class std::locale::id std::ctype<char>::id" (?id@?$ctype@D@std@@2V0locale@2@A)
tinyxmlparser.obj : error LNK2001: unresolved external symbol "private: static int std::locale::id::_Id_cnt" (?_Id_cnt@id@locale@std@@0HA)
tinyxmlparser.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z) referenced in function $L66790
tinyxmlparser.obj : error LNK2019: unresolved external symbol "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) referenced in function "public: static unsigned int __cdecl std::ctype<char>::_Getcat(class std::locale::facet const * *)" (?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@@Z)
tinyxmlparser.obj : error LNK2001: unresolved external symbol "struct std::_DebugHeapTag_t const std::_DebugHeapTag" (?_DebugHeapTag@std@@3U_DebugHeapTag_t@1@B)
tinyxmlparser.obj : error LNK2019: unresolved external symbol "public: __thiscall std::_Locinfo::~_Locinfo(void)" (??1_Locinfo@std@@QAE@XZ) referenced in function "public: __thiscall std::ctype<char>::ctype<char>(short const *,bool,unsigned int)" (??0?$ctype@D@std@@QAE@PBF_NI@Z)
tinyxmlparser.obj : error LNK2019: unresolved external symbol "public: __thiscall std::_Locinfo::_Locinfo(char const *)" (??0_Locinfo@std@@QAE@PBD@Z) referenced in function "public: __thiscall std::ctype<char>::ctype<char>(short const *,bool,unsigned int)" (??0?$ctype@D@std@@QAE@PBF_NI@Z)
tinyxmlparser.obj : error LNK2019: unresolved external symbol __Getctype referenced in function "public: struct _Ctypevec __thiscall std::_Locinfo::_Getctype(void)const " (?_Getctype@_Locinfo@std@@QBE?AU_Ctypevec@@XZ)
tinyxmlparser.obj : error LNK2019: unresolved external symbol __Tolower referenced in function "protected: virtual char __thiscall std::ctype<char>::do_tolower(char)const " (?do_tolower@?$ctype@D@std@@MBEDD@Z)
tinyxmlparser.obj : error LNK2019: unresolved external symbol __Toupper referenced in function "protected: virtual char __thiscall std::ctype<char>::do_toupper(char)const " (?do_toupper@?$ctype@D@std@@MBEDD@Z)
Debug\OgreMax.dll : fatal error LNK1120: 16 unresolved externals
Process terminated with status 1120 (0 minutes, 7 seconds)
32 errors, 0 warnings

Evak

05-04-2006 08:08:58

Just saw the new scene loader source was up .maybe we will get more luck this time. At least Ant should have some extra ram soon so he can use VC on his puter.