By using this site, you acknowledge that you have read and understand our Cookie policy, Privacy policy and Terms .

In this post, I am going to demonstrate how to use Eclipse to create and debug C/C++ programs for Unix/Linux in Windows. I am going to use Cygwin GCC as toolchains. Cygwin GDB will also be installed for debugging purpose. I am using Windows 10 and JRE 1.8 in the following steps.

Install Eclipse IDE for C/C++ Developers

Before installing Eclipse, please install JRE first (

And then go to Eclipse official site to download the installer.

Choose Eclipse IDE for C/C++ Developers in installation wizard. The version I installed is 4.5.2.


Install Cygwin

Cygwin is a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows. The functionality we will mainly use includes GCC (GNU compiler) and GDB (GNU debugger).

Install Cygwin by following the instructions in the following link:

You don’t need to select any package in the installation wizard as we will install the required ones later on. Please keep the setup file (setup-x86_64.exe) when exiting the wizard.

After installation, you will be able to use the Terminal as you would do in Linux/Unix.


Install Required Packages

Open one Command Prompt windows (using Administrator account) and run the following command line to install the packages.

setup-x86_64.exe -q -P wget -P gcc-g++ -P make -P diffutils -P libmpfr-devel -P libgmp-devel -P libmpc-devel –P gdb

In the above command line, –q means quite mode; –P to specify the package we need to install. The installer will resolve the dependencies automatically. 


(I have installed these packages before and there are no details in the standard output.)

You can use the Terminal to validate whether those packages are installed successfully. For example, input “man gcc”.


Create C Project

Open Eclipse and create one C project. Remember to choose Cygwin GCC as Toolchains.


The perspective for C/C++ project looks like the following screenshot.


In this sample, I am print out one string “Hello World!” and also create one test file.

   1:  /*
   2:   ============================================================================
   3:   Name        : CProgramTest.c
   4:   Author      : Raymond Tang
   5:   Version     :
   6:   Copyright   : Your copyright notice
   7:   Description : Hello World in C, Ansi-style
   8:   ============================================================================
   9:   */
  11:  #include <stdio.h>
  12:  #include <stdlib.h>
  14:  int main(void) {
  15:      printf("Hello World!\n"); /* prints !!!Hello World!!! */
  17:      /*Create a file*/
  18:      FILE *fp;
  20:     fp = fopen("/home/Raymond/test.txt", "w+");
  21:     fprintf(fp, "This is testing for fprintf...\n");
  22:     fputs("This is testing for fputs...\n", fp);
  23:     fclose(fp);
  25:      return EXIT_SUCCESS;
  27:  }

Before you build the project, please ensure the project PATH environment includes the Cygwin paths (which includes the C standard libraries).


Build the project and then click Run button to run the program.

Once the program runs, one test file is created in my Cygwin user home folder.


Debug The C Program

As we already installed GDB, you can easily debug C/C++ program. For example, add breakpoints and variable watch list and etc.



Microsoft Visual C++

If you are targeting Windows platforms, you can choose Microsoft Visual C++ as Toolchains. In this way, you don’t need to install Cygwin but you have to install Visual C++ instead.

On the other hand, Visual Studio is definitely better tool to use for this case especially you are a Microsoft technology related developer.

info Last modified by Raymond at 5 years ago * This page is subject to Site terms.

More from Kontext

visibility 713
thumb_up 0
access_time 9 years ago


open_in_new View open_in_new C and C++

visibility 442
thumb_up 0
access_time 10 years ago

这几天正在学习C++(非托管,无特别说明以下的C++均指非托管的C++,而非CLR C++),为了快速的学习和加深印象,我对照VB、C#来学习,通过对比他们的相同与不同处达到融会贯通的目的,以下是一些总结或者注意点,希望对其他C++(尤其是之前学习C#)的新手提供一些参考。我目前的学习资料是《Sams Teach Yourself C++ in One Hour a Day》英文版第六版,相关表述参照了其中的内容,并且以我自己的理解和语言进行描述,不准确的地方请见谅。

open_in_new View open_in_new C and C++

info About author

Dark theme mode

Dark theme mode is available on Kontext.

Learn more arrow_forward
Kontext Column

Kontext Column

Created for everyone to publish data, programming and cloud related articles. Follow three steps to create your columns.

Learn more arrow_forward
info Follow us on Twitter to get the latest article updates. Follow us