Eclipse and Make

A Duke C++ Eclipse project always includes a Makefile with instructions that Eclipse and the C++ compiler use to find libraries and include files necessary for creating an executable program, e.g., the Tapestry library and files.

The Makefile is used to handle complexities the compiler doesn't handle by itself. The command make invokes the compiler appropriately based on rules contained in the Makefile.

The standard Makefile created when a C++/Tapestry project is created compiles one .cpp file into an executable. Sometimes you'll need to create more than one executable in the same C++ project. Some Makefiles can handle this multiple target problem, others can be modified to handle multiple make targets.

This document provides a tutorial on using multiple targets in Eclipse.

Identifying Make Targets

After creating or snarfing a C++ project you'll need to identify the different targets you plan on using with the project.

Make sure you're using the C/C++ view and not the navigator view when adding make targets (otherwise you won't see the menus in the screen shots below).

To identify a target, right click-and-hold on the folder for the C++ project you're interested in. This is PigLatin in the diagram below. A menu will pop-up, scroll down and select Add Make Targets as shown in the diagram below. This will pop up a dialog box.

rightclick

Entering Make Targets

When the dialog box pops up, you should enter a new target. Do NOT include the word make, simply enter the target name, e.g., pigtest, anawordtest, etc. as shown in the diagram below.

rightclick

Invoking a Make Target

To build a project using a specific make target, i.e., one you entered using the mechanism above, you'll need to right-click on the project folder again as you did in the first step above.

Now, scroll down in the menu that pops up and select the Make submenu which (when you follow the arrow) will allow you to select one of the targets you've entered as shown in the diagram below.

When you select a make target the C-build pane will indicate what's being compiled and what errors, if any, result from compiling your code.

rightclick


Owen L. Astrachan
Last modified: Sat Oct 4 14:09:41 EDT 2003