The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Problem with static SDL2
Alexey Petruchik
Guest

I know that it is not intended way to use SDL but other people pressure me Smile
So... I've built debug static version of SDL2 linked to static runtime (/MTd) using Visual Studio 2013.
When I link my app to SDL2.lib I get this error message:


LIBCMTD.lib(fpinit.obj) : error LNK2005: __fltused already defined in SDL2.lib(SDL_stdlib.obj)



Using /NODEFAULTLIB ends up in having tons of unresolved externals to functions like fopen, fclose, memcpy etc. Can someone explain to me what went wrong I how I can fix that?


Regards, Alexey
Re: Problem with static SDL2
Sparks


Joined: 01 Jun 2013
Posts: 47
Alexey Petruchik wrote:
I know that it is not intended way to use SDL but other people pressure me Smile
So... I've built debug static version of SDL2 linked to static runtime (/MTd) using Visual Studio 2013.
When I link my app to SDL2.lib I get this error message:


LIBCMTD.lib(fpinit.obj) : error LNK2005: __fltused already defined in SDL2.lib(SDL_stdlib.obj)



Using /NODEFAULTLIB ends up in having tons of unresolved externals to functions like fopen, fclose, memcpy etc. Can someone explain to me what went wrong I how I can fix that?


Regards, Alexey

Why are you doing /NODEFAULTLIB? You need the default libs so that it can link in all the functions it needs.
MrTAToad


Joined: 13 Feb 2014
Posts: 205
Location: Chichester, England
Apparently :

__fltused implies you are using or have at least declared some floats or doubles. The compiler injects this 'useless' symbol to cause a floating support .obj to get loaded from the crt. You can get around this by simply declaring a symbol with the name

#ifdef __cplusplus
extern "C" {
#endif
int __fltused=0;
#ifdef __cplusplus
}
#endif