Using Eclipse For C++

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

This video demonstrates how to setup Eclipse for C program development and create several projects within a single workspace. The Eclipse C/C Development Tools (CDT) runs on top of the Eclipse Platform. The CDT provides advanced functionality for C/C developers, including: C/C Editor (basic functionality, syntax highlighting, code completion etc.) C/C Debugger (APIs & Default implementation, using GDB).

Using Eclipse for C Programming George Ferguson [email protected] September 2018 Updated Summer 2020 Abstract Students are used to using the Eclipse IDE for programming in Java. This document de-scribes how to install and use Eclipse for programming in C (and C). Amazingly, it isn’t as easy as it should be. C Program to Draw an Eclipse Shape Using C Graphics Write a program in C to draw an eclipse on screen using graphics.h header file In this program, we will draw an eclipse on screen having centre at mid of the screen.

Before installing Eclipse, please install JRE first (

How to use eclipse for c++ mac

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). Eve serenity killboard.

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.

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.

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++

Eclipse C++ Windows

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.

Using Eclipse For C++ Free

Write a program in C to draw an eclipse on screen using graphics.h header file

In this program, we will draw an eclipse on screen having centre at mid of the screen. We will use ellipse functions of graphics.h header file to draw eclipse on screen. Below is the detailed descriptions of ellipse function.

void ellipse(int xCenter, int yCenter, int startAngle, int endAngle, int xRadius, int yRadius);
Function ArgumentDescription
xCenterX coordinate of center of eclipse.
yCenterY coordinate of center of eclipse.
startAngleStart angle of the eclipse arc.
endAngleEnd angle of the eclipse arc. It will draw eclipse starting form startAngle till endAngle.
xRadiusHorizontal radius of the eclipse.
yRadiusVertical radius of the eclipse.

To draw a complete eclipse, we should pass start and end angle as 0 and 360 respectively.

C program to draw an eclipse using graphics

Using Eclipse For C++ 2020

In this program we first initialize graphics mode, by passing graphics driver(DETECT), default graphics mode and specifies the directory path where initgraph looks for graphics drivers (*.BGI). First of all we will calculate the center co-ordinates of eclipse which is the center of screen bu calling getmaxx and getmaxy function. Then we draw full eclipse by calling ellipse function.

Program Output

Using Eclipse For C++ Windows 10

Related Topics
C Program to draw a circle on screen
C graphics program to draw concentric circles
C program for bouncing ball animation
C Program to draw tangent(tan) graph on screen
C graphics program for moving car animation
C program to draw pie chart using graphics
C graphics program to draw digital clock
List of all C Graphics Programs