Configuring Eclipse for C & C++ Development

Installing and Configuring Eclipse for C/C++ Development

  1. Download and install Eclipse IDE for C/C++ Developers from http://www.eclipse.org/downloads/
  2. Download and install Cygwin from http://www.cygwin.com/install.html - This is required because Windows OS does not have a built-in compiler. An alternative to Cygwin is MinGW. However this tutorial only covers Cygwin.
    1. Download the file setup.exe and run it
    2. During installation select Install from the Internet – You will be required to select a Download Site later on the installation process
    3. Select what packages to install. This step is extremely important because, by the default, Cygwin will not install any of the required packages for Eclipse C/C++. Under Develselect the following:
      1. gcc-g++   -   This is the C++ Compiler
      2. gcc-core   -   This is the C++ Compiler
      3. gdb   -   This is the C++ Compiler
      4. make   -   This is the GNU version of the “make” utility
    4. Click next and let the installation finish. This process will involve downloading and installing the selected packages onto your system. It may take a few minutes.
  3. At this point you should be ready to begin programming in C and C++

 

Creating your first Project: Hello World

  1. Open Eclipse IDE for C/C++ Developers
  2. Create a new project
    1. FileNewProjectC/C++C++ Project
    2. Click next
    3. Under Project TypeExecutable select Hello World C++ Project
    4. Under Toolchains select the compiler you wish to use. If you have installed both Cygwin and MinGW you should see them both
    5. Finish the project creation and you should see a resulting .cpp file with a Hello World printout already done for you.
  3. Build and Run the new project
    1. Build the new project by CTRL + B
    2. Run the project by CTRL + F11
    3. Any compilations errors should appear under Problems and Console tabs

Notice that after building the project new binary files should appear in the Project Explorer window. You can execute the .exe file of the recently compiled application by going into your workspace and running the corresponding .exe file inside the Debug folder.