[SDL] Link SDL2 statically with Visual C++ 2012

Alex Barry alex.barry at gmail.com
Sat Mar 30 12:18:38 PDT 2013


Are you using Visual Studio 2012 for a Store application, or Desktop
application?


On Sat, Mar 30, 2013 at 10:08 AM, li <elie.huvier at gmail.com> wrote:

> **
> I encounter an error when statically linking SDL2 in my application with
> Visual 2012.
> I built SDL2 from latest repository, using the Visual 2012 project
> provided, with modifications so that it builds as a static lib with static
> VC runtime.
>
> The application builds, but at execution it crashes with "application.exe
> has triggered a breakpoint."
> According to Visual debugger, this happens line 98 in SDL_stdlib.c: (the
> line after _chktsk() below)
>
>
>
>  Code:
>
>  void
> __declspec(naked)
> _chkstk()
> {
> }
>
>
>
> I can build SDL2 as dynamic dll or static dll, and in both cases my
> application is working.
>
> If I build with SDL2 static lib, but with Runtime Library 'Multi-threaded
> debug' instead of 'Multi-threaded', my application works.
>
> I added dependencies to winmm.lib, imm32.lib, version.lib as explained
> here<http://stackoverflow.com/questions/11095424/how-to-statically-compile-an-sdl-game-on-windows-with-vs2010>
> .
> I tried to exclude LIBCMT as advised here<http://stackoverflow.com/questions/3007312/resolving-lnk4098-defaultlib-msvcrt-conflicts-with>,
> but then I get a bunch of unresolved externals.
>
> My application is just an SDL initialization and exit:
>
>
>
>
>  Code:
>
>  #include "SDL.h"
>
> int main(int argc, char** argv){
>    if (SDL_Init(SDL_INIT_VIDEO) == -1) {
>       return 1;
>    }
>
>    SDL_Quit();
>
>    return 0;
> }
>
>
>
> Any tips to investigate further would be great [image: Smile]
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130330/b3ed0cee/attachment-0009.htm>


More information about the SDL mailing list