Eclipse CDT on Linux

http://www.autexier.de/jmau/dev/CDT/cdt.html




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 letEclipse download it.

Assuming you have a 'standard' Linux system with make and gcc installedyou 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:
  • Binaries: contains build binaries, debug and release
  • includes: contain include files. Standard path as /usr/include,/usr/local/include are automaticaly added to the project
  • Debug: debug output directory (created when debug is build).contains makefile, object file and linked application
  • Relase: same as debug, but for release
  • you sample file



Makefile

The makefile, objects.mk and sources.mk are automatically generated. Itcontains few targets:
  • all: called when Porject->Build target is executed
  • ProjectName:
  • clean: clean build director
################################################################################
# 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 viewcontains the output of the application.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值