Advertisement

SDL and Linux (newbie here)

Started by January 10, 2005 11:07 AM
6 comments, last by eedok 20 years, 1 month ago
I've played around a bit with SDL library on Windows, but now when I have Mandrake 10.0, I can't find anywhere tutorial how to get it up and running on it. I'm pretty newbie with Linux.. Could anyone tell/link me how to get the SDL installed and how to compile programs using SDL with that gcc. Thanks in advance (don't you just like this phrase?)!
The best way Ive found to install the SDL libraries on linux is to download the source and install it from the source. the steps include.

SDL-1.2.8.tar.gz is the package you will download

tar -zxvf SDL-1.2.8.tar.gz
cd SDL-1.2.8
./configure
make
su
<enter in your password for root user>
make install
//you might have to do a ldconfig im not sure

that will install the libraries now all you have to do is include the libraries
when compiling with the gcc

inside your files you should be able to include the files the same way as with windows
#include <SDL/SDL.h>

g++ main.cpp -lSDL -lSDLmain

thats the gist of it.
These are the steps that I follow on a slackware 9.1 box it should work on most other linux distros.
Advertisement
Quote:
Original post by bignester
The WORST way Ive found to install the SDL libraries on linux is to download the source and install it from the source.
Fixed.

Just install mandrake's SDL-devel package.

and to compile, you're supposed to use sdl-config

gcc myfile.c `sdl-config --cflags --libs`
Speaking as a mod, please don't deliberately mis-quote people, even in jest...
Yeah, I agree that installing from source is a bad idea. Why not just use the ready made .rpm packages? It's a lot easier. You probably also want at least SDL_image (install the library and the -dev rpm), so you can load different image file formats.

And just one thing, the recommended way to include sdl is #include "SDL.h"
Ad: Ancamnia
well since I come from a slackware background Ive always found it easier to install from source than a package, anyway sorry if I might have misslead someone.
Advertisement
Thanks for help.
Well, couldn't get it working. I guess I got those development libraries installed but I can't get any code compiled with it for some reason. Well, probably not worth of trying anymore.
What errors does it give you when you try to compile?

This topic is closed to new replies.

Advertisement