Installation
If this the first time you are using Eclipse, try the following steps to install and run it successfully.
1. Download from
http://www.eclipse.org/downloads/
Eclipse IDE for C/C++ Developers
Check if your machine is of 32 or 64 bit using the link below if you are working in windows.
http://support.microsoft.com/kb/827218#method1
2. The C/C++ compiler also needs to be installed.
Download MinGW from
http://sourceforge.net/projects/mingw/files/MinGW/
By default Eclipse searches for MinGW in C:\, so ensure that there is a folder C:\MinGW
Opening Eclipse
1. Inside the Eclipse folder, click the "eclipse" application to launch eclipse
2. This will prompt you to select a workspace.
Give the path in which you would like your programs to be saved.
Creating the first C program
For college students migrating from Turbo C, the concpet of projects will be new. All programs are written in files inside projects.
So first we will create projects and then add files to it.
1. Creating a Project
File --> New --> C Project
Give a Project Name :
Eg. First
In Project Type :
Choose Executable --> Empty Project
In Toolchains:
Choose MinGW GCC
Click Next
In Select configurations
Check both Debug and Release
Click Finish
The project is listed in the project explorer in the left corner or take it from
Window --> Show View --> Project Explorer
2. Creating files inside project
Right click the Project Name.
i.e. First in our example.
Click New --> Source File
A "New Source File" window opens.
Give the name of the C file in Source File.
Eg. Source File : Main.c (c in lower case)
In the Editor panel for Main.c the program can now be typed.
Type a simple program.
Example
#include<stdio.h>
int main()
{
printf("Hi");
return 0;
}
"Unresolved Inclusion" Error
If you get the "Unresolved Inclusion error next to the #include, it means that the path has not been set properly.
Right Click the Project. i.e. First
- Open the Properties Window
- Expand C/C++ General
- Click Paths and Symbols
- In Includes tab
- Click GNU C in Languages
- Click Add thrice and add the following paths (assuming mingw is in C:\)
- c:/mingw/lib/gcc/mingw32/4.6.2/include
- c:/mingw/include
- c:/mingw/lib/gcc/mingw32/4.6.2/include-fixed
3. Build Project
Right click the project or use the "Project" menu.
Select "Build Project"
4. Run
Right Click the project and click
Run As --> Local C/C++ application
or
Click the run symbol (like the play button)