Thursday, 19 September 2013

Setting up SDL2 with MinGW and Sublime Text

Setting up SDL2 with MinGW and Sublime Text

I keep getting the error "undefined reference to WInMain@16" when I
include SDL2/SDL.h in my C file. It's a simple "Hello" program with the
SDL include, and if I remove the SDL include it compiles just fine (as
expected).
The problem is I'm new with the compile flags for C (and SDL) and I'm not
sure how I link(?) the files together (or if that's necessary). I'm coding
using Sublime Text 3.
(D:\CODE\Privata Projekt\C\test.c)
#include <stdio.h>
#include "SDL2/SDL.h"
int main(int argc, char *argv[]) {
printf("hello\n");
return 0;
}
My paths to MinGW and SDL2 is:
C:\MinGW\include\SDL2 (all my sdl header files reside in here too)
C:\MinGW\include\SDL2\bin
C:\MinGW\include\SDL2\lib
C:\MinGW\include\SDL2\share
And I build the program with
gcc test.c -o test

No comments:

Post a Comment