Wednesday, May 7, 2008

More Adventures in OpenSolaris

After successfully getting OpenSolaris up and running last night, I decided to test it in the one area I have been unsuccessfully struggling with while using Mac: SDL. This is a pretty essential C++ game programming library in my opinion, so getting it to work in OpenSolaris was something I was anxious to try.

Mac. You are getting one warning, and one warning only. OpenSolaris has SDL installed by default and automagically detects it with Sun Studio Express. You are built on a BSD core, start acting like it, I've REALLY had it with these frameworks. Seriously.

Sun Studio Express was fantastic to use, which I expected since I'm a huge Netbeans fan, and this basically IS Netbeans, just with a C/C++/Fortran focus. I did notice that I couldn't just build and run my app from the IDE right away, but this was rectified in seconds; all I had to do was specify -lSDL in the Additional Options field under the Command Line option in the Linker category of the Project Properties. Whew! (Believe me, it's easier to find that it sounds!)

Although it is a fairly simple matter to get the application to build and run from within the IDE, it was trivial (and probably better in the long run) to build in the command line:












And now running!












All credit for this example goes to lazyfoo's excellent SDL tutorial for the example and the pictures.

Now I will openly admit, for the sake of full disclosure, that this is more of a rant against OS X than anything else. I knew already that Linux is FAR better suited for real dev work, but being bullheaded as I was I wanted to try and get a full C++ environment working seamlessly for me, if for no other reason than to prove I could. I spent literally hours upon hours trying to coax the Mac into working for me, while this example took me less than an hour.

My less selfish and whiny motive was to simply show how easy it is to get up and running with simple game dev using SDL on OpenSolaris. Anyone looking to start out with game dev should be looking at Linux/Unix in general. In particular, if you're looking for a Linux/Unix environment that takes maybe an hour or so to get up and running and has everything you could need to do this dev work available to you with minimal extra installs, OpenSolaris is probably the way to go.

2 comments:

Anonymous said...

Hi,

Could you please tell finally which IDE you used (NetBeans/Sun Studio Express)?

--
Varun

HappyCodeMonkey said...

Wow sorry, I didn't see this before I had comment notification enabled.

I use Sun Studio Express for C++ development, and NetBeans for Java.