Game Development Community

Another "latest head " compile problem.

by Ace · in Torque Game Engine · 10/26/2003 (7:14 am) · 4 replies

Downloaded 10/26/03 7am

I am using win98se with vc 6.0 and service pack5, installed after all of windows updates.
Can anyone tell me how to corect this error:
Thanks.
Linking...
LIBCMT.lib(dosmap.obj) : error LNK2005: __dosmaperr already defined in LIBC.lib(dosmap.obj)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __alloc_osfhnd already defined in LIBC.lib(osfinfo.obj)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __set_osfhnd already defined in LIBC.lib(osfinfo.obj)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __free_osfhnd already defined in LIBC.lib(osfinfo.obj)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __get_osfhandle already defined in LIBC.lib(osfinfo.obj)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __open_osfhandle already defined in LIBC.lib(osfinfo.obj)
LIBCMT.lib(read.obj) : error LNK2005: __read already defined in LIBC.lib(read.obj)
LIBCMT.lib(lseek.obj) : error LNK2005: __lseek already defined in LIBC.lib(lseek.obj)
LIBCMT.lib(write.obj) : error LNK2005: __write already defined in LIBC.lib(write.obj)
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
../tools/texture2bm8.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

texture2bm8.exe - 10 error(s), 1 warning(s)

#1
10/26/2003 (9:56 pm)
Try adding the line as suggested in the Link warning. I'm not sure the option name in VC6, but it should look something like "Exclude Library" or "Exclude Default Library". When you find it, put in LIBCMT. When you add it, the command line should have something like:
"... /NODEFAULTLIB:LIBCMT".

The problem is that VC in general has a reference to a set of libraries that it wants to link to, in this case that list include LIBCMT. The library LIBC is also included for linking and both libraries have the same functions listed. The linker coesn't know which lib to use so you get th error "...already defined...". You could remove LIBCMT from your core set of libraries as well, but I wouldn't suggest it. It's easier to do it per-project and leave the defaults alone unless you know what you're doing and why you're removing it.

-Nerseus
#2
10/26/2003 (10:04 pm)
What that error basically means is you're trying to link to a library that was compiled to use a different run time to the library you're compiling the .exe as.

Make sure all of the libraries and the .exe are compiled with the same runtimes. Usually, for Release builds it will be Multithreaded and debug builds Debug Multithreaded.

This could also happen if you accidentally link to a debug library in a release build or vice versa.

You can of course follow what the error message suggests, but if you do be prepared for problems particularly in the memory area.

HTH,

T.
#3
10/27/2003 (6:32 am)
Hi, thanks for the replys, i dont understand how i compiled with two diferent libs with diferent runtimes, i used to compile torque with no errors straight from cvs , do you think i could uninstall vc and reinstall it and start over and it will help?

The only other thing i done to vc was compile q2, i have changed nothing except added 2 exe's for q2 to compile.

Sorry, im not sure i understand your replys,
#4
06/11/2005 (10:39 am)
Fix by right clicking texture2bm8 files, settings, C/C+, code generation, then change Use run time lidrary from Single-threaded to Multithreaded, recompile twice.