Reputation: 113
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
Upvotes: 1
Views: 1646
Reputation: 113
Okay so, as keltar mencioned it looks like the problem was that in my program,
int main(int argc, char const *argv[])
the argv array was constant which as stated in here it won't work.
So the correct code would be:
int main(int argc, char *argv[])
Upvotes: 2