PDA

View Full Version : Getting SDL to work in the GUI IDEs.


the_it
November 15th, 2005, 03:14 AM
Hi! I'm trying out several development suites for C++ in Ubuntu, and I like the simplistic/minimalist interface of Anjuta/Gnome apps. I'm an SDL programmer doing some classwrapping around SDL and I tried out KDevelop for my project. It works like a breeze, very well, except that it's kinda a bit bloated for me so I wanted to try something else.

KDevelop, unfortunately, has default project templates for SDL applications that Anjuta does not. Being used to the managed interface of gui w32 apps like bloodshed dev-cpp, I can't move to completely text based emacs management without a significant amount of effort. Is there any quick, general setup method to setup Anjuta or other GUI IDEs to make an SDL project? Which IDE besides KDevelop (it's not bad, I just want something lighter) would you recommend for it's features?

gord
November 15th, 2005, 06:50 AM
all you need to get SDL to work in any gcc compiler is to add '/usr/include/SDL/' to the compiler include's, add SDL to the linkers library list and '/usr/lib/' to the linkers list... alllthough you might not need the last one, im just used to doing it. unless of course your include and lib folders are somewhere else.

all else you need is the obvious
#include "SDL.h"

you might want to look into using tools like Automake and Autoconf as well, these will manage the compling and linking for you and also make you all nice and portable. im not sure about anjuta but Eclipse uses make itself, just generates its own makefile.

try and stay away from auto generated code and templates.. not that its my place to tell you howto code but learning and knowing yourself how it all comes together can help you out and make your projects easyer for someone else to get going on other systems :)

vgeddes
November 15th, 2005, 11:13 AM
Yes, I agree, IDE's and project templates don't really help you learn and improve your skills, and sometimes they actually make life more complicated. Use them when you have got your project already set-up and just need a comfortable editing environment.

the_it
November 16th, 2005, 12:43 AM
Actually, I just use the templates to handle the library linking for me. I've never really used any autogenerated code before.

===

Thanks! I finally got it to link.

I'll take your advice and read up on autoconf and friends. KDevelop uses it too, and so does Anjuta, so I'd better see what's under the hood.

Biased turkey
November 22nd, 2005, 09:38 PM
all you need to get SDL to work in any gcc compiler is to add '/usr/include/SDL/' to the compiler include's, add SDL to the linkers library list and '/usr/lib/' to the linkers list... alllthough you might not need the last one, im just used to doing it. unless of course your include and lib folders are somewhere else.



Thanks for that valuable info Gord, I can now compile SDL applications with Anjuta. I'll ditch KDE and Kdevelop all together :)
Step 1:adding '/usr/include/SDL/' to the compiler include's was not necessary, I forgot to add it and was still able to compile my SDL program.

the_it
November 27th, 2005, 01:24 AM
well, I think you just need to make user /usr/include is in the includes, because "real" SDL developer's prefix their SDL includes with "SDL/" hehe ;p