Installing and Configuring Eclipse for C/C++ Development
- Download and install Eclipse IDE for C/C++ Developers from http://www.eclipse.org/downloads/
- 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.
- Download the file setup.exe and run it
- During installation select Install from the Internet – You will be required to select a Download Site later on the installation process
- 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:
- gcc-g++ - This is the C++ Compiler
- gcc-core - This is the C++ Compiler
- gdb - This is the C++ Compiler
- make - This is the GNU version of the “make” utility
- 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.
- At this point you should be ready to begin programming in C and C++
Creating your first Project: Hello World
- Open Eclipse IDE for C/C++ Developers
- Create a new project
- File – New – Project – C/C++ – C++ Project
- Click next
- Under Project Type – Executable select Hello World C++ Project
- Under Toolchains select the compiler you wish to use. If you have installed both Cygwin and MinGW you should see them both
- Finish the project creation and you should see a resulting .cpp file with a Hello World printout already done for you.
- Build and Run the new project
- Build the new project by CTRL + B
- Run the project by CTRL + F11
- 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.