Getting a basic program working is a breeze
I develop in C++ for the NetBurner environment. While the development environment comes with many tools that run only on the PC, it occurred to me that I should be able to develop non-hardware specific code on my home Mac. I downloaded the Galileo version of Eclipse that comes with the CDT bundle. Creating a basic program was very similar to working on the PC version. The problems started when I tried to write the unit tests. I downloaded UnitTest++ and created a project for it and created a library with no problem. I then tried to link in that static library with my code and was beset by several days of frustration.
The first thing I noticed is that the process for specifying a library on the Mac differs from that used by the NetBurner tool chain on the PC. In my NetBurner too chain when you want to link in a library you can specify the path either through the workspace or the file system and you specify it all the way to the actual library file as shown in the figure below. This makes perfectly good sense to me. It’s very hard to screw this up. (I’ve subsequently discovered that most tool chains DON’T work this way, they work more like the Mac version described below. Anyone care to tell me why?)
Linking a Static Library is Like Being In Irons for Three days
(for those that don’t sail, it’s another way of saying your aren’t going anywhere fast)
On the Mac, instead of a single “Libraries” area where you add a file there are two areas. One where you specify the library folder and one for specifying the filename itself. Doesn’t seem too bad but since the filename area has no browsing buttons it does open you up to typing errors. More importantly, it turns out that in my opinion there are some serious bugs in the name handling of libraries on the Macintosh version of the tool. It took me days to get my library file to be recognized.
I backtracked and created a simple one method library and originally called it TinyLib.a. When things didn’t work, something in the process led me to believe that the convention on the Mac was to name library files with a “lib” prefix. So I rebuilt to get libTinyLib.a Still no luck. Eventually, I put on my lucky green socks, stood on my left leg, hopped around in a circle (counterclockwise only mind you) and THEN started trying bizarre things like typing in the names of files that were similar but don’t really exist. Turns out if you have a file called libTinyLib.a, the Mac version of CDT will only find it if you lie and tell it the file is called TinyLib; note no “lib” prefix and no “.a” suffix. I then went back to UnitTest++.a and linked it by giving it the name without the suffix and that too worked. Of course I’m still wearing my lucky green socks so I’m not sure if it will continue to work once I take them off; which is too bad because they are beginning to get a tad bit malodorous.