In an earlier post I had provided what I had hoped were great instructions for getting CodeBlocks to work on a Macintosh so that you can work through the examples in C++ All-In-One Desk Reference For Dummies. The instructions do, in fact, work for most people, but they don’t work for everyone. So, part of the reason for this post is to ask for your input. If you’re a Mac user who has encountered problems getting CodeBlocks to work, but solved the issue in a way that differs from my previous post, please let me know all the details about your technique (including the symptoms and step-by-step solution) at John@JohnMuellerBooks.com.
In the meantime, I have discovered a few new pieces of information. For one thing, you can verify that you have the GNU GCC compiler installed by opening a terminal, typing gcc -v, and pressing Enter. If GNU GCC is installed, you should see some version information along with some compiler instructions. A failure message will look something like this:
If you don’t have the GNU GCC installed, there seems to be all sorts of conflicting information online on how to resolve the problem. Most of the advice suggests a rather lengthy download and installation process because apparently GNU GCC isn’t shipped with all versions of the Mac (I’m of the opinion right now that it definitely didn’t ship with any Mac OS X version prior to 10.4, which is why the download at http://www.codeblocks.org/downloads/5 won’t work in this instance and doing things like resetting the compiler will also result in failure.)
One of the best pieces of advice I can offer is to check the CodeBlocks Wiki for Mac-specific information. The current advice is to download the Xcode developer tools from http://developer.apple.com/technologies/tools/, which apparently is a large download—in excess of 4 GB—so be prepared to do something else while you wait. I found similar advice on sites such as Tech-Recipes and the nixCraft forum. If you have a better solution, please let me know and I’ll be all too happy to share it here on my blog.
As a final note, if someone could let me know the actual installation directory for GNU GCC on the Mac, I’d really appreciate it. I understand that the installation directory is probably /usr/bin/gcc, but I’d like to be sure.