Learning a programming language like C or C++ require a integrated development environment or IDE. Now, as we know IDE are available of different sophistications, Like Eclipse CDT (C/C++ Development Tools) for professionals and Intermediates, Old school TurboC/TC++ for a DOS based environment, And various other tools like Netbeans, Microsoft Visual Studio, etc. Since Eclipse CDT is the most used IDE for C/C++ development, So, it would be good to start with eclipse CDT even for beginner’s, intermediates in order to give them the taste of good coding practice and professional tools available which may help them in their career.

No matter what background you are from and your level of programming knowledge, this step by step guide is for anyone who is trying to figure out the simplest and effective way to setup eclipse cdt for C/C++ development environment in windows.

3 Things You Need To Setup Eclipse CDT

  1. Java runtime environment (JRE) for Eclipse software to run
  2. Compiler toolchain like GCC compiler toolchain
  3. Eclipse CDT Software

Compiler toolchains are simply some programming tools which are chained together. Means, each tool will call or trigger execution of other tool after it’s work is over as a result a chain of tools are formed. Example – The GNU Toolchain

Step 1 – Download Java

Though only java jre (java runtime environment) will suffice our need, but I’d prefer to download the complete java software development kit or JDK, for any feature of it you may need in future. So, to make sure we never run into any kind of errors, let’s download the latest JDK.

Download Oracle Java (JDK) – Select Download JDK

download java se jdk

Now click on the Accept License Agreement and select the latest suitable version of jdk to download. Windows x86 for 32-Bit windows and Windows x64 for 64-bit windows.

select jdk version - setup eclipse cdt

Once downloaded, Install the JDK. After installation, Navigate to the installation folder, which would be in C:Program FilesJava. You should be seeing two folder’s one for JDK and another for JRE. Now Let’s add JRE and JDK to windows environment path.

Now navigate to each folder and further into bin folders in each JDK and JRE folders. Once in bin folder, click on your Address bar to copy the absolute path to the bin directory, which would be something like this –

C:Program FilesJavajdk1.8.0_25bin

C:Program FilesJavajre1.8.0_25bin

The bolded portion may differ, since at the time of writing this article 1.8.0_25 was the latest version. You need to copy these paths and paste into a notepad.

Now right click on My Computer and go to properties. Follow the screenshot below :

setup eclipse cdt environment variable

Now in path add a “;” at the end if not present and then add the two paths separated again by a “;“.  Click ok to save and reboot your system.

Step 2 – Download GCC Compiler

Head over to download gcc compiler from equation.com and install, the process is simple and while installing make sure you manually change the installation path to C:MinGW , this is to avoid any naming convention mismatch. In this case you wont need adding any variable paths, since the installer will automatically take care of that.

But, if your wish to use your choice of toolchain like tdm-gcc or mingw from sourceforge, you can always download their windows .exe installer’s and install them and add the paths to bin folder like we did in step – 1 for jdk. Make sure you add a delimiter “;” after each parameter or path.

Now, you may reboot your system.

To test, if you have correctly installed gcc or not, fire up command prompt. You can do that by right clicking on start button. Or hit Win+R and type “cmd” without quotes.

Type these commands to verify the version of GCC :

setup eclipse cdt test gcc

Now that we are done, let’s download Eclipse CDT for C/C++ developement.

Step 3 – Download Eclipse CDT

Choose the latest version and Your flavour for 32-Bit or 64-Bit windows and Download Eclipse. You dont need any installation since the executable will be in compressed zip file which you’ll need to extract. After extraction, copy the the folder to C:Program Files. Enter the folder and right click on eclipse and select pin to start or pin to taskbar , now you have your eclipse ready to use.

We are done with setting up eclipse.

Now, Here are some basic settings for eclipse, which are highly recommended for everyone.

First is making MinGW GCC as your preferred toolchain so that each time you create a project in eclipse you need not have to select a tool chain.

Under Windows -> Preferences

make toolchains preferred

Second is to make a project use C/C++11 standard in case you are using any C++11 features. Or you can also use C++14 in stead of C++11 for all features of C++14 to be available in compilation.

Under GCC C++ Compiler -> Miscellaneous Type in -std=c++11 to enable c++11 features.

c++11

Under GCC C Compiler -> Miscellaneous type in -std=gnu11 to enable C11

c11

After these settings here is a quick step by step c programming guide using Eclipse.

  1. Click on File -> New -> C Project
  2. Type in a project name , lets say helloworld
  3. Hit finish
  4. In Project Explorer in left side, Right click on helloworld or your newly created project and select New -> File
  5. Lets type hello.c and hit enter
  6. Now your hello.c would be created and opened up for editing, you can always double click on hello.c to open it in editor window.
  7. Lets create a helloworld program


Copy the code above or type in your’s own code to test. After finished typing  hit CTRL+S to save the file. Then go to Project -> Build project , This would build and compile your C program and report any errors. Then hit CTRL+F11 to RUN your program.

Hope that should get you started with C/C++ Programming. Happy programming.

Add your valuable thoughts to the discussion

Notify of
avatar
wpDiscuz