Thursday, September 19, 2024

Revisiting C/C++ On Eclipse

The tutorial from IBM’s developerWorks on using the C/C++ Development Toolkit (CDT) for Eclipse received a refresh over the summer, and it merits a look from those who may have missed it since then.

In the writeup on IBM’s website about Eclipse and C/C++ development, Warsaw-based writer Pawel Leszek talked about making Eclipse the framework for creating applications in C.

Leszek specifically looks at equipping Eclipse with a set of plug-ins to make the environment into the nicely-equipped CDT a developer will need. He listed them and a summary of each one:

•  Primary CDT plug-in is the “framework” CDT plug-in.
•  CDT Feature Eclipse is the CDT Feature Component.
•  CDT Core provides Core Model, CDOM, and Core Components.
•  CDT UI is the Core UI, views, editors, and wizards.
•  CDT Launch provides the launch mechanism for external tools such as the compiler and debugger.
•  CDT Debug Core provides debugging functions.
•  CDT Debug UI provides the user interface for the CDT debugging editors, views, and wizards.
•  CDT Debug MI is the application connector for MI-compatible debuggers.

Getting the CDT up and running varies depending on the operating system of choice. Eclipse and Java SDKs would need to be installed and running properly. Linux users have GCC on their systems, so they are all set. Windows users will need to grab either Cygwin or the MinGW toolkit first.

Once the CDT components are installed, three new options will be available for projects: C (“Standard C Make Project”), C++ (“Standard C++ Make Project”), and “Convert to C or C++ Projects”. Eclipse can import existing source code through use of the File-> Import -> File System command.

Leszek noted how the CDT IDE recognizes C/C++ syntax. Eclipse will do syntax highlighting, code colorizing, and code formatting. The Outline window shows procedures, variables, declarations, and functions in the source code.

CDT also has code completion. The developer can update the code templates the assist function draws from, or add new ones as desired. Also, CDT maintains a local code history, so even if a developer is not using version control this will show local changes made in the source.

To build projects, CDT depends on GCC, GDB, and make. Leszek warned that “source code packages use the autoconf script for checking the build environment, so you need to run the configure command, which creates the “Makefile” before compilation.”

The Run menu in Eclipse provides the options needed to run and debug the application as needed. Options for running a project can be set for Run, such as profiles to run under, arguments to pass to the application, or environment variables.

Under Debug view, CDT adds functions for debugging C/C++ code. The developer can set breakpoints or watchpoints, and trace variables and registers according to Leszek. Overall there are plenty of features to make CDT an option to consider for those who want to try Eclipse out for C/C++ work.


Tag:

Add to Del.icio.us | Digg | Yahoo! My Web | Furl

Bookmark Murdok:

David Utter is a staff writer for Murdok covering technology and business.

Related Articles

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

Community golden gate estates.