Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c++ linker error LNK2005 already defined in SDL

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

like image 389
codetemplar Avatar asked Aug 31 '16 14:08

codetemplar


1 Answers

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

like image 84
codetemplar Avatar answered Oct 22 '22 13:10

codetemplar