Jump to content
  • Advertisement
Sign in to follow this  
lethalhamster

I need help getting started with SDL in Linux

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am getting started with SDL. I have a dual boot XP/Mepis computer and wanted to get more into develoement in Linux. I have gotten(is that a word?) A simple SDL app in windows, but I dont have the slightest idea how do do it in Linux. I use Kedit and my IDE and gcc as my compiler. I also have Mepis Linux 3.3 (I think its Kernel version 2.6.10...). I need to nkow how to set it up to get a simple window, I dont know how to link all the SDL, SDLmain, and all those other things that I used to "linker options" for in Dev-C++. Thanks for any help, and ask questions if I didnt make myself clear enough.

Share this post


Link to post
Share on other sites
Advertisement
I'm assuming you already have the .h and .a files (they should be in /usr/include/SDL and /usr/lib respectively)

If you have 2 source files named src1.cpp and src2.cpp (can have more), this command should work:

g++ src1.cpp src2.cpp -lSDL -lpthread -o prog

This calls g++ (which is just gcc with c++ options) telling it to compile these source files and link them to the SDL and pthread libraries. It will produce an executable named "prog"

After getting that to work, I would suggest learning how to write makefiles.

Share this post


Link to post
Share on other sites
Here's the SDL on linux FAQ.

Here are some tutorials.

The easiest way to get a simple SDL app to compile on linux (assuming the file is test.c) - type this into the command line :
gcc -o test test.c `sdl-config --cflags --libs`

I'd also recommend spending some time with the SDL documentation. It's a bit sparse, but most of what you need to know for SDL is in there.

Share this post


Link to post
Share on other sites
Programming Linux Games


That's an entire book in PDF form for you right there. It gives a pretty good intro into how to write SDL programs in Linux and covers all the basics, but leaves out details into things like how to code your own video engine, OpenGL, etc. Still, it helped me to learn SDL pretty fast, and the example code in the book is available too (use google).


Honestly though, I think the SDL docs/wiki at http://www.libsdl.org/ are enough to get anyone started. Just have a little patience, SDL doesn't take long to learn. [smile]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!