Eclipse CDT on Linux
Nov. 2004 by Jean-Marc Autexier


Purpose
Small tutorial about Eclipse CDT on Linux.



Overview

Versions:



Installation
The installation is straighforward, just add CDT url ( http://update.eclipse.org/tools/cdt/releases/new) to update and let Eclipse download it.

Assuming you have a 'standard' Linux system with make and gcc installed you can start directly with C development.



Coding
Then add a new file (regular file, there is no particular C/C++ file) and write you C application.

#include <iostream>
#include <string>
using namespace std;

int main()
{
string yourName;

cout << "Enter your name: ";
cin >> yourName;
cout << "Hello " + yourName << endl;

return 0;
}
Configuration

Check project property and choose between "Release" or "Debug" configuration.
The project has the following structure:



Makefile

The makefile, objects.mk and sources.mk are automatically generated. It contains few targets:
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

ROOT := ..

-include $(ROOT)/makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include $(SUBDIRS:%=%/subdir.mk)
-include objects.mk
-include $(DEPS)
-include $(ROOT)/makefile.defs

all: ManageMakeTest

ManageMakeTest: $(OBJS)
@echo 'Building target: $@'
g++ -o $@ $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building: $@'

clean:
-$(RM) $(OBJS) $(DEPS) ManageMakeTest

.PHONY: all clean dependents

-include $(ROOT)/makefile.targets

Build

Choose Project->Build project. Build output will be written to "Console" view.

**** Full rebuild of configuration Release for project ManageMakeTest ****

make -k clean all
rm -rf HelloWorld.o HelloWorld.d ManageMakeTest
Building file: ../HelloWorld.cpp
g++ -O3 -Wall -c -fmessage-length=0 -o HelloWorld.o ../HelloWorld.cpp
Finished building: ../HelloWorld.cpp

Building target: ManageMakeTest
g++ -o ManageMakeTest HelloWorld.o
Finished building: ManageMakeTest
Build complete for project ManageMakeTest

Execution
Select makefile (of debug or release) and "Run". The console view contains the output of the application.






(c) Jean-Marc Autexier