实验 SDL 了一个小程序,在linux 正常
而后在 MingGW 编译通过
gcc -I/local/include -L/local/lib -w -Wl,-subsystem,windows -lmingw32 -lSDL2main -lSDL2
得到 a.exe, 但运行卡住了,没有任何反应 (看来SDL 在MingGW主要能支持窗口显示)
// http://de.wikibooks.org/wiki/SDL:_Joystick
// modified by Joachim Schiele
// feel free to use this code for whatever you want to do....
// example2.cpp can be compiled with:
// g++ example2.cpp -o example2 `sdl-config --libs` `sdl-config --cflags`
#include <stdio.h>
#include <SDL2/SDL.h>
int main ( int argc, char *argv[] )
{
if ( SDL_InitSubSystem ( SDL_INIT_JOYSTICK ) < 0 )
{
fprintf ( stderr, "Unable to initialize Joystick: %s\n", SDL_GetError() );
return -1;
}
//while (1) {
// continue;
//}
printf ( "%i joysticks found\n", SDL_NumJoysticks ()