Saturday, August 25, 2012

CppUnit with Eclipse CDT Tutorial

About Eclipse CDT

Eclipse C/C++ Development Toolkit (CDT) is an extension to the Eclipse platform in the form of a plug-in. This plug-in is available for download for all platforms. The open source nature of the plug-in with its user-friendliness makes it more popular not just among the Linux developers but also among C++ developers on other platforms. CDT and the Web Tools plug-ins are the two most popular Eclipse plug-ins. Nearly two out of three developers using CDT are Windows users.

CDT has subcomponents or plug-ins that are independent projects in the CDT community. The most important is the CDT primary plug-in, which provides the core CDT capabilities. CDT Debug UI provides the UI capabilities for the debug editors and views. CDT UI plug-in provides the UI-related features, views, editors, wizards, etc. CDT Debug provides core debugging capabilities. CDT Feature provides CDT Feature component. CDT core presents Core Model, CDOM, and other core components. CDT Launch provides launch mechanism for launching external executables and tools. CDT Debug MI is the application connector for MI-compatible debuggers.

CDT editors have several features that make them popular. For example, syntax highlighting and code assist make software development quick and easy. Syntax highlighting is configurable and can be personalized to your individual taste. Code assist is the code completion feature that is similar to the one in Visual Studio. Custom-defined code templates can be added to the plug-in, which can be used by code assist.
In the following sections, we will learn how to use CDT effectively to use for testing project with CppUnit.

Installing Eclipse CDT

Download http://eclipse.org/downloads/ - i.e. eclipse-cpp-XXX-linux-gtk-x86_64.tar.gz 
Eclipse also requires the Java installation.

1. Download the Cpp``Unit distribution file Cpp``Unit-1.10.2.tar.gz and unpack it in a directory of your choice. From now on we will refer to this directory as $Cpp``Unit .
2. Run MSys to open a command line shell, then cd to the directory where you extracted Cpp``Unit and do:
./configure

There's no need to go any further than this with make, make install, etc. All we will need is the header $Cpp``Unit/include/Cpp``Unit/config-auto.h which has been generated in the step above.
Go to Eclipse and create a Managed Make C++ Project to generate a library (either static or shared).
Import all .h and .cpp files in $Cpp``Unit/src/Cpp``Unit to the project.
Open the project properties configuration dialog (Alt + Enter) and add $Cpp``Unit/include to the include path.


No comments:

Post a Comment