GP2X -lsdl, How This Work?


MadDog

Member
Joined
Mar 4, 2006
Messages
262
Age
55
Location
UK
Website
www.maddoggames.com
Just getting my head around GCC.

So, how does -lSDL instruct the linker to like to the SDL libs and which file is it linking against? With MS tools I would have to do sdl.lib if the SDL were all built to one lib called sdl.lib But I can't not find any file soley called sdl And no *.lib files too.

Any good docs about for mirgation from MS tools to gcc tools? Doing a google give me a lot of spam. :(

Helps to fix probs if I have a ruf idea to how gcc works.

Thanks,
Richard e Collins.
 
I think the file would be called SDL.o and should be in a libs/ directory.

I might be wrong though. The linux build tools are still a bit of a black box to me. I know how to get them to work (mostly) but not why. I'm learning though, and I'm sure you will too.
 
MadDog posted on Mar 14 2006 at 08:41 PM said:
Just getting my head around GCC.

So, how does -lSDL instruct the linker to like to the SDL libs and which file is it linking against? With MS tools I would have to do sdl.lib if the SDL were all built to one lib called sdl.lib But I can't not find any file soley called sdl And no *.lib files too.

Any good docs about for mirgation from MS tools to gcc tools? Doing a google give me a lot of spam. :(

Helps to fix probs if I have a ruf idea to how gcc works.

Thanks,
Richard e Collins.

Normally you'll have a script called "sdl-config", which is run inline. This script adds to the command line some necessary arguments, including some directory information. It's easier to do than to describe:

g++ -O2 -o vidpok *.cpp `sdl-config --cflags --libs` -lSDL -lSDL_image -lSDL_mixer

Note the direction of the single-quote there. It's the one at the top-left of the keyboard.
 
Last edited by a moderator:
-lSDL tells the compiler to look in the libs directory you give it or the default one (in that order) for a libSDL.a.
 
Yer, I did a few file renames to see what files it was reading, is the word 'lib' at the start of the lib a standard or a GP2X thing? IE libSDL.o instead of SDL.lib

I'm going to dig out the gcc docs I think, is the gcc we are using for GP2X using the same cmdline syntax as the standard gcc or has there been any tweeks? Just so when I read the docs I know i'm reading stuff that will work. :)

Thanks,
Richard e Collins.
 
The lib in front and the .a on the end are both standard GCC things. The command-line syntax is exactly the same as far as I know.
 
Back
Top