Reputation: 7803
I am trying to build a project on windows using MinGW and eclipse. I'm using the SDL library but when i try to complie it, I get the error
g++ -Wl,-subsystem,windows -oplikoo.exe src\mouse.o src\camera.o src\Timer.o src\Pegs.o src\Graphics.o src\FPS.o src\Ball.o -lmingw32 -lSDLmain -lSDL.dll -lSDL_image -lSDL_mixer
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libSDLmain.a(SDL_win32_main.o): In function `console_main':
/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:315: undefined reference to `SDL_main'
I understand that main has to have the int main(int argc, char *argv[])
signature, and #include <SDL.h>
in that file, but it still does not work.
Upvotes: 2
Views: 6437
Reputation: 340
This just happend to me. When i started to define main with the args parameters:
int main(int argc, char* args[])
the compiler error wen away.
Upvotes: 5
Reputation: 8826
Scanning over your compilation line there, I noticed you are attempting to link against "SDL.dll" directly. That's not what you want. You should be linking against libSDL.la (provided you are actually using mingw).
Also, I'm not sure if this affects anything here, but I've heard that you are "supposed to" link to "SDL" last.
Upvotes: 2