after creating a simple SDL Application for learning purposes.
GCC wouldn't let me away with this.
it gave me a bunch of compiler errors.
here is my simple SDL source code:
Code:
#include<SDL/SDL.h>
#include<stdio.h>
#include<stdlib.h>
int main()
{
SDL_Surface *screen;
/* Initiliaze SDL's Video system and check for errors. */
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf("Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}
/* Make sure that SDL exits when the program exits.*/
atexit(SDL_Quit);
/* attempt to make a 640 X 480 hiColor Mode. */
screen = SDL_SetVideoMode(640, 480, 16, SDL_FULLSCREEN);
if (screen == NULL) {
printf("Unable to set video mode: %s\n", SDL_GetError());
return 1;
}
/* als alles is gelukt */
printf("SDL has bin successfully loaded.\n");
}
And this is how I tried to compile the code:
gcc main.c -o gametest -I/usr/include/SDL -D_REENTRANT -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread
I also tried this:
gcc main.c -lSDL -o test
And this:
gcc main.c -o gametest `sdl-config --cflags --libs`
and nothing worked.
I keep getting these errors:
......
..........
(a view other thousand error messages here...)
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x122c): In function `SDL_XDGAGetViewportStatus':
: undefined reference to `_XFlush'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x12e3): In function `SDL_XDGASync':
: undefined reference to `_XReply'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1320): In function `SDL_XDGASync':
: undefined reference to `XMissingExtension'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1344): In function `SDL_XDGASync':
: undefined reference to `_XFlush'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x140b): In function `SDL_XDGAChangePixmapMode':
: undefined reference to `_XReply'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1454): In function `SDL_XDGAChangePixmapMode':
: undefined reference to `XMissingExtension'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1474): In function `SDL_XDGAChangePixmapMode':
: undefined reference to `_XFlush'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1560): In function `SDL_XDGACreateColormap':
: undefined reference to `XMissingExtension'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x158c): In function `SDL_XDGACreateColormap':
: undefined reference to `_XFlush'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x16f2): In function `SDL_XDGACloseFramebuffer':
: undefined reference to `XMissingExtension'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1775): In function `SDL_XDGACloseFramebuffer':
: undefined reference to `_XFlush'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x199a): In function `SDL_XDGAOpenFramebuffer':
: undefined reference to `_XReply'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x19e0): In function `SDL_XDGAOpenFramebuffer':
: undefined reference to `XMissingExtension'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1a72): In function `SDL_XDGAOpenFramebuffer':
: undefined reference to `_XRead'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1a94): In function `SDL_XDGAOpenFramebuffer':
: undefined reference to `_XFlush'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA.o)(.text+0x114): In function `SDL_XF86DGAGetVideoLL':
..............
(and here)
This is probably a linkingphase error.
but how to fix it?
Is there a library I'm missing?