6
votes

I am compiling my program using VS2005. I am linking to SDL static libraries and am getting the following linker errors;

1>LIBCMTD.lib(fpinit.obj) : error LNK2005: __fltused already defined in SDL2d.lib(SDL_stdlib.obj)
1>LIBCMTD.lib(ftol2.obj) : error LNK2005: __ftol2_sse already defined in SDL2d.lib(SDL_stdlib.obj)
1>   Creating library ..\..\..\product\VS2005\libs\\Standalone.lib and object ..\..\..\product\VS2005\libs\\Standalone.exp
1>..\..\..\product\VS2005\libs\\Standalone.exe : fatal error LNK1169: one or more multiply defined symbols found

I compiled SDL2d.lib using the same VS2005 compiler. My original thought was that I had mismatched runtime library settings for these projects. However after checking they are both set to Multi-Threaded Debug.

I have just noticed that the linker output above seems to be creating a Standalone.lib and Standalone.exp before making the Standalone.exe. I have no idea why it's making a .lib and .exp

Any other reasons why this error would occur?

Thanks

1
This means you are using more than 1 runtime. It seems here you are mixing Debug and Release in the same application. LIBCMTD.lib is part of the debug CRT. LIBCMT.lib is part of the release CRT. If you are building a Debug application make sure not to use Release libs and viseversa.drescherjm
"However after checking they are both set to Multi-Threaded Debug." That cannot possibly be correct. And if it is, you're linking to another library that you didn't mention in the question. The linker errors very clearly indicate that the conflicting library is LIBCMT, which is the release version.Cody Gray
Thanks, unfortunately my quote was wrong. Ive edited the question and replaced LIBCMT.lib with LIBCMTD.lib. The linker output doesn't mention LIBCMT.lib, just somehow went missing during my copy and paste. My apologies, question editedcodetemplar
The edit only fixed it in one place. The output also says: defaultlib 'LIBCMT' conflicts with use of other libs...Cody Gray
You are still clearly trying to link object files targeting two different versions of the CRT. One or more of your project settings have to be incorrect, or there have to be additional libraries involved that you aren't telling us about (and haven't rebuilt). There isn't enough information here to provide any further help. This isn't a bug in Visual Studio; I've successfully compiled and linked many projects in VS 2005.Cody Gray

1 Answers

9
votes

Needed to define HAVE_LIBC in the SDL project. This stopped the multiple redefinition of both _ftlused and _ftol2_sse