[SDL] Help to compile

Ulrich Eckhardt doomster at knuut.de
Sun May 20 11:42:53 PDT 2007


On Sunday 20 May 2007 18:00:49 Igor Castro wrote:
> Hi! I'm newbie on this list and i cant compile my c++/SDL program under
> windows... I use:
> gcc SDL_teste.cpp -lSDLmain -lSDL  -mwindows

There are several errors here:
1. You don't have warnings turned on. For current GCCs, use '-W -Wextra', for 
older ones (up to 3.4 or so) use '-W -Wall'.
2. When you are compiling C++ code, use the C++ compiler, i.e. use 'g++' 
instead of 'gcc'.
3. To compile portably, just use the output of the 'sdl-config' program for 
compiler and linker flags. This should automatically get it right.

Also, in your program, don't include <SDL/SDL.h> but just "SDL.h". 
Again, 'sdl-config' will do the rest for you.

Uli


More information about the SDL mailing list