CodeBlocks on a Macintosh – Part 2

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:

My-MacBook-Pro:~ someone$ gcc -v
-bash: gcc: command not found

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 downloadin excess of 4 GBso 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.

 

Author: John

John Mueller is a freelance author and technical editor. He has writing in his blood, having produced 99 books and over 600 articles to date. The topics range from networking to artificial intelligence and from database management to heads-down programming. Some of his current books include a Web security book, discussions of how to manage big data using data science, a Windows command -line reference, and a book that shows how to build your own custom PC. His technical editing skills have helped over more than 67 authors refine the content of their manuscripts. John has provided technical editing services to both Data Based Advisor and Coast Compute magazines. He has also contributed articles to magazines such as Software Quality Connection, DevSource, InformIT, SQL Server Professional, Visual C++ Developer, Hard Core Visual Basic, asp.netPRO, Software Test and Performance, and Visual Basic Developer. Be sure to read John’s blog at http://blog.johnmuellerbooks.com/.

When John isn’t working at the computer, you can find him outside in the garden, cutting wood, or generally enjoying nature. John also likes making wine and knitting. When not occupied with anything else, he makes glycerin soap and candles, which comes in handy for gift baskets. You can reach John on the Internet at John@JohnMuellerBooks.com. John is also setting up a website at http://www.johnmuellerbooks.com/. Feel free to take a look and make suggestions on how he can improve it.