Hello,
Just for little fun I am trying to compile the first simple program using SDL libs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#include <stdlib.h>
#include <SDL.h>
using namespace std;
int main(int argc, char *argv[]) {
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
exit(1);
}
return 0;
}
|
As you can see it's pretty simple.
I have a precompiled libsdl1.2-dev installed which leaves SDL headers under /usr/include/SDL
and I also downloaded SDL from the origianl webpage to try, but no avail.
I am compiling using this:
g++ `sdl-config --cflags --libs` sdl-example.cpp -o sdl-example
and I get:
/tmp/ccVhU6dF.o: In function `main':
sdl-example.cpp:(.text+0x11): undefined reference to `SDL_Init'
sdl-example.cpp:(.text+0x1d): undefined reference to `SDL_GetError'
collect2: error: ld returned 1 exit status
Changing the include to "SDL.h" or "SDL/SDL.h" makes no difference.
I also tried the same with gcc and got the same result.
sdl-config --cflags --libs gives this:
-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
-L/usr/lib/i386-linux-gnu -lSDL
Anyone knows what I am doing wrong?