Integrating GCC MinGW with Eclipse IDE

Recently, i need to work with C/C++ projects which i’ve never done it before in my job. I was working with HTML5/Javascript using Eclipse as it’s the Smart TV main IDE. I always know that Eclipse is a good guy and it should be able to do C/C++ development since i’ve seen C/C++ developer edition in download page, now the challenge is how to make my current eclipse (Smart TV IDE) able to compile and run the C/C++ codes.

First step is installing the CDT (C/C++ Development Tooling) Support for Eclipse:

  1. You can go to Eclipse CDT Download page and search the correct repository for your eclipse build (mine still use indigo)
    (http://www.eclipse.org/cdt/downloads.php)
  2. In the Eclipse IDE, Add the new repository of Eclipse CDT
    (Help >> Install New Software >> Add)
  3. Put the Repository URL in Location, if there is a note mentioning duplicate location, check and enable it at “Available Software Sites”
  4. Select the newly created Repository from Combo Box
  5. Check the “CDT Main Features” package and install it
  6. Done and Restart the Eclipse, you should see the C/C++ Project type in New Project list
  7. If there is no toolchain available or getting “Launch Failed. Binary Not Found”, go follow the steps below…

Now eclipse is supporting us to code in C/C++ language BUT not compiling and run it since the eclipse need external compiler for that. Then let’s ask MinGW to do this job, if you already have another C/C++ compiler such as Dev-Cpp you can skip this to the next steps for setting up environment variable.

  1. Download the MinGW Installer from http://sourceforge.net/projects/mingw/files/Installer/
  2. Open and Install the mingw32-base and mingw32-gcc-g++, some of other package may also installed because of dependency

The last step is to put your C/C++ Compiler at your environment variables, simply put the Path to bin of your compiler at user/system environment on PATH values, for example:

  1. If you have compiler from Dev-Cpp just put/add PATH values
    “C:Dev-Cppbin”
  2. Or from MinGW installer more or less is
    C:MinGWbin
  3. Open your command line (run/search: cmd) and type “gcc –version” to check if your gcc is available from any path
  4. Restart the Eclipse IDE and try again (Don’t forget to Build/Rebuild first before running the application)

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Navigation