SDL under RHL 7.2
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?
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!]
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!]
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
Something like this:
gcc foobar.c -lSDL
Edited by - Clash Rocker on January 13, 2002 10:40:10 PM
Yes, errors such as these almost always mean that you''re not linking to a required lib.
rm -rf /bin/laden
rm -rf /bin/laden
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.
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.
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.
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.
Thanks for the help.
Is this a typical scenario when it comes to most Linux libraries? Do they all have ???-config files?
Is this a typical scenario when it comes to most Linux libraries? Do they all have ???-config files?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement