vurtun / nuklear

A single-header ANSI C gui library
13.68k stars 1.11k forks source link

Fix SDL2 demos main signature #928

Open nsauzede opened 4 years ago

nsauzede commented 4 years ago

Current SDL2 nuklear demos fail to build on Windows (mingw64) :

nuklear/demo/sdl_opengl3$ make
rm -f bin/demo.exe
cc main.c -std=c99 -pedantic -O2 -o bin/demo.exe -lmingw32 -lSDL2main -lSDL2 -lopengl32 -lm -lGLU32 -lGLEW32
In file included from C:/msys64/mingw64/include/SDL2/SDL.h:32,
                 from main.c:14:
main.c:73:5: error: conflicting types for 'SDL_main'
   73 | int main(void)
      |     ^~~~
In file included from C:/msys64/mingw64/include/SDL2/SDL.h:32,
                 from main.c:14:
C:/msys64/mingw64/include/SDL2/SDL_main.h:121:29: note: previous declaration of 'SDL_main' was here
  121 | extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
      |                             ^~~~~~~~
make: *** [Makefile:25: demo.exe] Error 1

This trivial patch changes int main(void) into int main(int argc, char *argv[]) which is the correct C main() signature