Advertisement

Library conflict

Started by August 01, 2007 09:07 PM
14 comments, last by derefed 17 years, 4 months ago
The same way you do it for your application. You'll have to open the project settings for the library and choose the runtime library it should use. Then recompile the library before linking it with your application.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Okay, I went back and opened the "msvc8" solution in the angelscript folder. I checked the runtime library, it was set to "Multi-threaded Debug DLL". I made sure I was in debug mode. I compiled the library, then copied it into the VC\lib directory, overwriting the previous instance of "angelscriptd.lib". I then went into the project I'm having problems with that uses angelscript. I set it to "Multi-threaded Debug DLL", and the linker had this to say:

1>Linking...
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: _calloc already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: _realloc already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetDbgFlag already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(fflush.obj) : error LNK2005: _fflush already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(setlocal.obj) : error LNK2005: _setlocale already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(atox.obj) : error LNK2005: _atoi already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(strtol.obj) : error LNK2005: _strtol already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(strtol.obj) : error LNK2005: _strtoul already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(mbstowcs.obj) : error LNK2005: _mbstowcs already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(wcstombs.obj) : error LNK2005: _wcstombs already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(swprintf.obj) : error LNK2005: __swprintf already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(iswctype.obj) : error LNK2005: _iswctype already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(ismbbyte.obj) : error LNK2005: __ismbblead already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(tolower.obj) : error LNK2005: _tolower already defined in MSVCRTD.lib(MSVCR80D.dll)
1>LIBCMTD.lib(fputwc.obj) : error LNK2005: _fputwc already defined in MSVCRTD.lib(MSVCR80D.dll)
1> Creating library Debug\wx_MUD_2.lib and object Debug\wx_MUD_2.exp
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LIBCMTD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>Debug\wx_MUD_2.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://e:\My Documents\My C++\wx_MUD_2\wx_MUD_2\Debug\BuildLog.htm"
Advertisement
The situation changed. Now for the inverse. :)

Looks like you're linking with wxWidgets as a static library, or maybe you're linking with some other library as well.

Try changing the setting to Debug Single-threaded (non-DLL) for both AngelScript and your application.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

There is no "single-threaded" option. Do you mean "Multi-threaded Debug"?

My options are "Multi-threaded", "Multi-threaded Debug", "Multi-threaded DLL", and "Multi-threaded Debug DLL".
There isn't? Have Microsoft removed that option for MSVC 8.0?

Well, then I suppose you should use "Multi-threaded Debug".

LIBCMTD.lib must be coming from wxWidgets since you set both AngelScript and your application to use "Multi-threaded Debug DLL". Changing to the non-DLL version should work.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Ah! That did it! Thank you so much, WitchLord. I don't know what I'd do without you.

This topic is closed to new replies.

Advertisement