linker errors recompiling the engine

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Yustme
Posts: 107
Joined: Sat Dec 01, 2007 10:50 pm

linker errors recompiling the engine

Post 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!
Ico
Posts: 289
Joined: Tue Aug 22, 2006 11:35 pm

Post 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.
Yustme
Posts: 107
Joined: Sat Dec 01, 2007 10:50 pm

Post 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?
luigi2004
Posts: 12
Joined: Sat May 27, 2006 3:49 am

Post by luigi2004 »

if u think its a define problem then undefine it

there a command for this too
i think #undef
Yustme
Posts: 107
Joined: Sat Dec 01, 2007 10:50 pm

Post 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;
Ico
Posts: 289
Joined: Tue Aug 22, 2006 11:35 pm

Post 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. :)
Yustme
Posts: 107
Joined: Sat Dec 01, 2007 10:50 pm

Post 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
Ico
Posts: 289
Joined: Tue Aug 22, 2006 11:35 pm

Post by Ico »

Project settings (of release configuration)? There should be an entry for preprocessor settings under "configuration properties" -> "C/C++".
Yustme
Posts: 107
Joined: Sat Dec 01, 2007 10:50 pm

Post 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!
Post Reply