8
Developing C/C++ applications with the Eclipse CDT David Gallardo

Developing C/C++ applications with the Eclipse CDT David Gallardo

Embed Size (px)

Citation preview

Page 1: Developing C/C++ applications with the Eclipse CDT David Gallardo

Developing C/C++ applications with the Eclipse CDT

David Gallardo

Page 2: Developing C/C++ applications with the Eclipse CDT David Gallardo

Getting started with CDT• Requirements:

– A version of the Eclipse Platform compatible with Eclipse CDT

– The Eclipse CDT (Install via Update from: http://download.eclipse.org/tools/cdt/releases/new)

– CDT does not include a compiler! You need a separate C/C++ toolset including compiler, linker, make utility and standard libraries.

– Linux includes these; in Windows, you’ll have to install Cygwin or MinGW.

Page 3: Developing C/C++ applications with the Eclipse CDT David Gallardo

Configure Eclipse

• Select debugger:– (GNU gdb)

• Select binary parser:– (Project Properties -> C/C++ Make Project -> Binary

Parser Check only PE Windows Parser

• Enter build command:– Select Windows->Preferences->C/C++->Make->New

Make Projects– Under Make Builder, in Build command section,

uncheck the Use default box, and enter: mingw32-make –f makefile

Page 4: Developing C/C++ applications with the Eclipse CDT David Gallardo

Views in C/C++ perspective

• C/C++ Projects (the file navigator for C/C++ resources)

• Navigator (the file navigator for all Eclipse resources)

• Console • Properties • Tasks • Make Targets • Outline • Search

Page 5: Developing C/C++ applications with the Eclipse CDT David Gallardo

Views in C/C++ Debug perspective

• Debug • Variables • Breakpoints • Expressions • Registers • Memory • Outline • Console • Tasks

Page 6: Developing C/C++ applications with the Eclipse CDT David Gallardo

C/C++ editor features• Syntax highlighting

• Content assist is available for:– Fields, Variables – Methods ,Functions – Classes, Structs,Unions – Namespaces – Enumerations– Code templates you can create and edit

• Debugger integration

Page 7: Developing C/C++ applications with the Eclipse CDT David Gallardo

Managed vs. standard make projects

• CDT offers two types of C and C++ projects: standard make and managed make

• Standard make projects allow you create and manage your own makefile. Pros and cons:– Flexible and powerful– Can be difficult to create and maintain

• In managed make projects, CDT creates and manages the makefile for you. Pros and cons:– Build is automatic—no need to deal with messy makefiles– Don’t have complete control over build process

Page 8: Developing C/C++ applications with the Eclipse CDT David Gallardo

Demo

• Create a C program—Hello, World!, of course!– Create C/C++ project (using standard make)

– Create source file(s)

– Create makefile

• Running a C program– Create Run configuration

– Run

• Debug