Transcript Document

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.
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: mingw32make –f makefile
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
Views in C/C++ Debug
perspective
•
•
•
•
•
•
•
•
•
Debug
Variables
Breakpoints
Expressions
Registers
Memory
Outline
Console
Tasks
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
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
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