I've created a game with SDL2 library in ubuntu with the atom editor, and for compiling created a makefile with this code:
game: main.c LoadGame.c Events.c CreateTex.c CollisionDetection.c Render.c gameStatus.c gcc main.c LoadGame.c Events.c CreateTex.c CollisionDetection.c Render.c gameStatus.c -w -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -o game -lm -I.
And now I want to create an .exe so I created this makefile:
game: main.c LoadGame.c Events.c CreateTex.c CollisionDetection.c Render.c gameStatus.c i686-w64-mingw32-gcc main.c LoadGame.c Events.c CreateTex.c CollisionDetection.c Render.c gameStatus.c -w -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -o game.exe -lm -I.
but it gives this error:
In file included from /usr/i686-w64-mingw32/include/SDL2/SDL.h:32:0, from main.c:2: main.c:8:5: error: conflicting types for ‘SDL_main’ int main(int argc, char const *argv[]){ ^ /usr/i686-w64-mingw32/include/SDL2/SDL_main.h:117:39: note: previous declaration of ‘SDL_main’ was here tern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); ^~~~~~~~ makefile:5: recipe for target 'game' failed make: *** [game] Error 1
So I'd like some help so I can create a single .exe file from my sourcecode to run it in windows,while
char**
andchar const **
are different types. Write yourmain
exactly asint main(int argc, char *argv[])
(orchar **argv
as these types are equivalent here). It is answered in SDL windows FAQ – keltar-lmingw32 -lSDL2main -lSDL2
rather than just-lSDL2
. – HolyBlackCat