April 15, 2004

The Cross In Cross-Platform

Filed under: Daedulus — Ryan Wilcox @ 11:38 am

This week I’ve been working on the outstanding issues for the Daedulus project. One of the smaller issues I finished up yesterday, and now I’m on to one of the bigger issues – taking this application cross-platform.

Since we’re using wxWidgets for this project, most of my code is ready to rock on other platforms – and with my new, production, PC I have a cross-platform environment in which to work.

You see, I installed Fedora Core on the PC, as well as installing all my favorite unix utilities on the Windows partition.

Here then are my thoughts…

Running on Fedora

I had my linux environment pretty much set up the way I like it – directory structure, utilities, etc. Off I go to compile wxWidgets… ok, not bad, standard stuff…

For those of you not as familiar with unix as I am, I’ll take a degression here. Unix, in one form or another, has been around since the beginning of time() – 1970 or so. Since then it’s branched off a bit, then Linux was created, and things got really messy (there are many many distributions of Linux, in addition to the multitude of distributions of unix that already existed). The differences between the distributions of unix are mostly philosophical – where things should be stored, how much functionality is provided at the core – technical things like that.

Luckily, all these distributions are based around (pretty much) the same tools – the same way to build programs, the same basic file commands, etc. The basic utilities have been around for 30 years now, so they’re pretty familiar to everyone.

So, even though the application is getting tested on at the client’s site with FreeBSD, if I can compile and run it with my Fedora install, he should be able to do the same with his FreeBSD install.

My plan of attack is formulated – download, build, and install wxWidgets, then try my hand at getting one of my C++ files to build.

I got one file to compile, finally, but wouldn’t it be nice if I had a record of the commands I used? A shell script, maybe, to compile these things. Hmmm… seems like a common thing to do… oh wait, what about make?

A makefile (the file that make reads from, hence the name) is composed of instructions – what files to compile, what compiler to use, things like that. It took me a minute (or 2, or 30) to understand make’s syntax enough to do what I wanted. I had an example file created for me, with the basics, I just had to figure out where to add my additional gcc flags.

After a bit of futzing, I got it working – make compiled all my files with gcc using my commands. Nothing’s linking just yet (I haven’t figured out the command for that), but everything is compiling. That seemed like a good stopping point, so I committed my changes and quit for the night.

Windows Compiling

Now I’m spending some time learning how to compile on Windows. For this project we’re using the free Dev-C++ IDE which hooks into the Cygwin version of gcc. Using another compiler is always a fun journey – setting up your paths, wondering where this or that setting is, hoping that your not missing something… knowing that you are. Oh, and lest we forget – all the custom key commands that are (by now) pretty much hard-wired into my brain.

On the other hang, using a graphical IDE is a lot more helpful than using straight command line tools. Thank you very much BloodShed Software!

Aptly Named Conclusion

I’ll be so glad when I can get back to my desk – the PC is on the workbench, I’ve been using a stool all day to sit on. I miss my back support.

2 Comments

  1. Hi,

    i dwnloaded devc++ 4.9.8 beta ;WxWindows-2.4.2.DevPak ; imagelib-2.DevPak .

    i installed devc++, then dblclked the other two PAK files to install those libraries.

    so now i have the wxwidgets libraries in my devc++ directory, but the programs are not compiling.

    Since you have done this , could u pl point out anything that i have missed.

    Comment by aby — May 29, 2004 @ 9:58 am

  2. Aby,

    First, you gave me no useful information on what’s going on – I have nothing to help you by. Output from the compiler saying “Error on line XXX in File blah.cpp, blah-blah-blah” would be useful.

    Secondly, while I did it, I’m certainly not an expert with installing wxWidgets on the PC. There are other more informed people on there.

    For general help please see the the wxWidgets-users list: http://wxwidgets.org/maillst2.htm

    Also, please read http://wxwidgets.org/mlhowto.htm before you post to the list – your more apt to get useful help if you post details such as compiler output, what you tried, etc etc.

    Hope this helps

    Comment by Ryan Wilcox — May 30, 2004 @ 12:19 am

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.