#### Archived

This topic is now archived and is closed to further replies.

# SDL under RHL 7.2

This topic is 5881 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Since I have given up porting my homemade graphics library to Linux, I have taken others'' suggestions to use SDL. I just installed it and it won''t let me compile the SDL_init.c example. It''s the most basic program using the SDL library. I tried fiddling with ld.so.conf and I ran ldconfig, but all I get with gcc is: undefined "SDL_Init" undefined "SDL_Quit" Blah Blah Does anyone know why I might be encountering this problem?

##### Share on other sites
How are you compiling it? Have you tried:
gcc -o abc abc.c sdl-config --cflags --libs
That should do it. I don''t know about this "SDL_init.c example" (maybe I''m blind ), but does it include the SDL headers required?

[Resist Windows XP''s Invasive Production Activation Technology!]

##### Share on other sites
The 'undefined "SDL_Init"' says you're not linking the SDL library.

Something like this:
gcc foobar.c -lSDL

Edited by - Clash Rocker on January 13, 2002 10:40:10 PM

##### Share on other sites
Yes, errors such as these almost always mean that you''re not linking to a required lib.

##### Share on other sites
Do it the Null and Void way, the sdl-config --cflags --libs part makes sure you link with the correct libraries, and use the correct include paths, if you still get the same error, run # sdl-config --cflags --libs directly from the command line, and make sure its output is right (the directory names exist and contain the needed libs and headers)

then you can edit the /usr/bin/sdl-config (or /usr/local/bin/sdl-config if you compiled from tars) to output the right paths.

hmmm . . . did you compiled from tars?, Redhat comes with a SDL-devel rpm, if you did, and the rpm was installed durring the OS setup (or later), they might be conflicting.

##### Share on other sites
To resume all the helpful replies:

1) Make sure the SDL Development package is installed. By default, Redhat7.2 installs the SDL runtime library rpm only. The SDL development libraries are located in the SDL-devel 1.2.2-3 rpm located on one of the binaries CDROM.

2) Make sure the source code includes SDL/sdl.h header

3) Compiles the program with the command:
gcc SDL_init.c -o SDL_init sdl-config --cflags --libs

and ... voila that''s all there is to do.

##### Share on other sites
Thanks for the help.

Is this a typical scenario when it comes to most Linux libraries? Do they all have ???-config files?

##### Share on other sites
as far as I know, GTK++ and SDL are the ones that have that *-config script so far (GTK was the first one I think), but it is a good idea don''t you think? we can expect new Libraries to implement the functionality.