Today, I was trying to develop C/C++ code in Mac OS using eclipse. However, I could not find any resource that properly tells me how to install gcc in mac as a prerequisite for developing C/C++ code in eclipse. Therefore, I am leaving this piece of note here for other people to use and describe the easy! problem of making GCC and eclipse work together in Mac OSX. So, please follow the following steps if you have this problem:
1- easiest way to install C/C++ is installing gcc through Xcode in Mac. Do that through “App store”. Search Xcode in “App Store” and follow steps to install it.
2- However, installing Xcode does not necessarily mean gcc is installed. So, do the following to make sure that gcc is installed. In Xcode menu bar, go to Xcode>preferences. Install “Command Line Tools” (click the install button in front of this choice).
3- To make sure that gcc is installed, open a Terminal and key in: gcc -v
if everything is installed correctly, you should get some lines that shows the version and other details of the installed gcc.
4- Install eclipse from http://www.eclipse.org/downloads/ (preferably select the version for C/C++).
5- Open eclipse and set up a workspace directory somewhere on your disk.
6- Create a new project in eclipse: file>new>C Project. Key in a “project name”.
Under the “project name” and “location”, there is a box called “Project Type”. Make sure that for “executable”, you select “Empty Project” and in the right side box, make sure that you select “MacOSX GCC”. I experienced that selecting the other option (i.e., Cross GCC) does not allow eclipse to run your project. In fact, by choosing this wrong option you’ll get the annoying message of “Launch fail. Binaries are missing” when you try to run your project.
I hope this piece of note helps.