Problem with static SDL2

I know that it is not intended way to use SDL but other people pressure me
:slight_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

Alexey Petruchik wrote:

I know that it is not intended way to use SDL but other people pressure me :slight_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.

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