Page 1 of 1

linker errors recompiling the engine

Posted: Sat Jan 05, 2008 5:23 pm
by Yustme
Hi,

I'm recompiling the library of the irrlicht engine with the option "Multi-threaded DLL (/MD)".

But i get these 4 linker errors:

Code: Select all

Error 1       error LNK2019: unresolved external symbol __imp___getcwd_dbg referenced in function "public: __thiscall irr::io::CFileList::CFileList(void)" (??0CFileList@io@irr@@QAE@XZ)  CFileList.obj
Error 2 error LNK2001: unresolved external symbol __imp___getcwd_dbg  CFileSystem.obj
Error 3 error LNK2019: unresolved external symbol __imp___fullpath_dbg referenced in function "public: virtual class irr::core::string<char,class irr::core::irrAllocator<char> > __thiscall irr::io::CFileSystem::getAbsolutePath(class irr::core::string<char,class irr::core::irrAllocator<char> > const &)const " (?getAbsolutePath@CFileSystem@io@irr@@UBE?AV?$string@DV?$irrAllocator@D@core@irr@@@core@3@ABV453@@Z)  CFileSystem.obj
Error 4 error LNK2019: unresolved external symbol __imp___CrtSetDbgFlag referenced in function _DllMain@12  Irrlicht.obj
Error 5 fatal error LNK1120: 3 unresolved externals d:\irrlicht-1.4\bin\Win32-visualstudio\Irrlicht.dll 1

If i use "Multi-threaded DEBUG DLL (/MD)" as option, i dont get these errors.

I rather stick with the "Multi-threaded DLL (/MD)" option.

Any idea how to fix these linker errors?

Thanks in advance!

Posted: Sat Jan 05, 2008 6:29 pm
by Ico
Looks like that specific release build tries to call some debug-only functions somewhere.

You're sure _DEBUG isn't defined somewhere (testing or by accident)?

As it lists DllMain i guess the following #ifdef is true

Code: Select all

#if defined(_DEBUG) && !defined(__GNUWIN32__) && !defined(__BORLANDC__) && !defined (_WIN32_WCE)
as that one is the only #if block there containing any debug code I see atm.

Posted: Sat Jan 05, 2008 7:08 pm
by Yustme
Ico wrote:Looks like that specific release build tries to call some debug-only functions somewhere.

You're sure _DEBUG isn't defined somewhere (testing or by accident)?

As it lists DllMain i guess the following #ifdef is true

Code: Select all

#if defined(_DEBUG) && !defined(__GNUWIN32__) && !defined(__BORLANDC__) && !defined (_WIN32_WCE)
as that one is the only #if block there containing any debug code I see atm.

Hi Ice,

I've found a few times "_DEBUG" in "CFileList.cpp" and "CFileSystem.cpp" and i commented those lines.

But the linker errors still remain.

Code: Select all

/*#ifdef _DEBUG
setDebugName("CFileList");
#endif*/

/*#ifdef _DEBUG
	if ( false == ret )
	{
		os::Printer::log("Could not open file. UnZipfile not added", filename, ELL_ERROR);
	}
#endif*/

/*#ifdef _DEBUG
	os::Printer::log("Could not open file. Zipfile not added", filename, ELL_ERROR);
#endif*/

/*#ifdef _DEBUG
	os::Printer::log("Could not open file. Pakfile not added", filename, ELL_ERROR);
#endif*/
Anything else i can do?

Posted: Sun Jan 06, 2008 1:36 am
by luigi2004
if u think its a define problem then undefine it

there a command for this too
i think #undef

Posted: Sun Jan 06, 2008 6:54 pm
by Yustme
luigi2004 wrote:if u think its a define problem then undefine it

there a command for this too
i think #undef
Hi,

I got it fixed thanks to your hint :D

Code: Select all

case DLL_PROCESS_ATTACH:
			#if defined(_DEBUG) && !defined(__GNUWIN32__) && !defined(__BORLANDC__)
				//_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF);
			#endif
			#undef (_DEBUG)
			break;

Posted: Sun Jan 06, 2008 7:54 pm
by Ico
That #undef won't be global (juts for everything that line of code within that one file). So if you've got some time, try to find the real source of the problem. :)

Posted: Sun Jan 06, 2008 10:46 pm
by Yustme
Ico wrote:That #undef won't be global (juts for everything that line of code within that one file). So if you've got some time, try to find the real source of the problem. :)
Hi,

I wouldn't know how the source of the problem would look like, even if i am looking at it.

I can't go to the definition of _DEBUG with the vs2005 menu, because it isn't defined (thats why i got the linker errors).

Looking for _DEBUG made me go through the entire project (if i didn't stop the search).

But if you know (or got a hunch) where the source of the problem is (for example file), let me know :D

Posted: Sun Jan 06, 2008 11:05 pm
by Ico
Project settings (of release configuration)? There should be an entry for preprocessor settings under "configuration properties" -> "C/C++".

Posted: Sun Jan 06, 2008 11:14 pm
by Yustme
Ico wrote:Project settings (of release configuration)? There should be an entry for preprocessor settings under "configuration properties" -> "C/C++".
Hi,

No wonder i couldn't find it! So i was suppose to look in the options ha :D

Thanks!