Sign in to follow this  
superkent

SDL Question.

Recommended Posts

Hello, Quick question about SDL. Off the bat Im sorry if this is a double post. I was going through Lazy Foo's SDL tutorials (props on them they are quit good!), and need to know what "-lmingw32 -lSDLmain -lSDL" means? I know it tells the linker where to find the SDL librarys etc, but Im one that has trouble doing something "because thats just how you do it." If anyone can tell me exactly what I am telling the linker that would be great! I want to know incase in the future I need to add to this line, I at least know what it is doing. Thanks.

Share this post


Link to post
Share on other sites
Actually, it doesn't tell the linker where to find them - it tells the linker which ones to use. The example you've given tells the linker to use the "mingw32", "SDLmain" and "SDL" libraries. The "-l" at the beginning just means "link to this library."

Share this post


Link to post
Share on other sites
I'm having problems seeing what exactly you don't understand. Is it specific to SDL, or you just want to know what "libraries" and "linking" is? Anyway, if you have installed SDL correctly, you will have the files SDL.a and SDLmain.a in your libraries directory(.lib extensions for other compilers). Those files contain already compiled code(binary) for SDL routines like SDL_SetVideo(). For example, you call SDL_SetVideo() from within your program, but where's the code for it? Not in "SDL.h", that contains only the interface, not the implementation. That's exactly what this line does. The compiler compiles your program, and then the linker links the result with the specified libraries so that the resulting .exe will run correctly.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this