Game Development Community

Linker errors integrating new libraries.

by James Ford · in Torque Game Builder · 06/21/2008 (8:04 pm) · 1 replies

I am attempting to integrate an AI library with TGB ( Game::AI++ ). However I'm totally stumped after two days of staring at linker errors. First I was getting "redeclaration of symbol new" errors. I tracked that down to the torque memory manager clashing with the library's use of stl. I tracked down the "fix" to TORQUE_DISABLE_MEMORY_MANAGER, and now I'm getting the following...

1>------ Build started: Project: TGBGame, Configuration: Debug Win32 ------
1>Linking...
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>test1.obj : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: bool __thiscall std::_Tree<class std::_Tmap_traits<class alive::Node *,class alive::Transform *,struct std::less<class alive::Node *>,class std::allocator<struct std::pair<class alive::Node * const,class alive::Transform *> >,0> >::const_iterator::operator==(class std::_Tree<class std::_Tmap_traits<class alive::Node *,class alive::Transform *,struct std::less<class alive::Node *>,class std::allocator<struct std::pair<class alive::Node * const,class alive::Transform *> >,0> >::const_iterator const &)const " (??8const_iterator@?$_Tree@V?$_Tmap_traits@PAVNode@alive@@PAVTransform@2@U?$less@PAVNode@alive@@@std@@V?$allocator@U?$pair@QAVNode@alive@@PAVTransform@2@@std@@@5@[[62820b560d7d9]]A@@std@@@std@@QBE_NABV012@@Z)
1>alive.lib(Scheduler.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>alive.lib(Interpreter.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>alive.lib(Registry.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>libcpmtd.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)
1>libcpmtd.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)
1>../../../tgb/gameData/T2DProject/TGBGame_DEBUG.exe : fatal error LNK1120: 3 unresolved externals
1>Build log was saved at "file://c:\Projects\TGB_GameAI++_Integration\engine\Link\Debug.Win32\TGBGame\BuildLog.htm"
1>TGBGame - 8 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 6 up-to-date, 0 skipped ==========

From what I've googled, these errors are "related" to your /MTd or /MT linker settings (or maybe not). I have already ensured that both the ai project and the TGBGame project are set to /MTd.

#1
06/22/2008 (5:51 pm)
It turns out that for some reason Torque has LIBC, LIBCD, LIBCMT and LIBCMTD as "ignored libraries". I assumed that this was because Torque used the the 'CP' versions, eg. LIBCPMTD. I'm not sure how to tell VisualStudio which of the two to use, but apparently setting "compile as C++/C" does not do this.

Anyhow by removing LIBCMTD as an ignored library all the errors went away. If anyone happens to have more information of why exactly this worked, feel free to make a post '-) but at least it did.