2003-11-28 21:50:02 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
< html lang = "en" >
< head >
2004-06-02 19:01:38 +00:00
< meta http-equiv = "Content-Language" content = "en-us" >
< meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" >
2004-06-21 10:33:03 +00:00
< title > Building C/C++ projects< / title >
2004-06-02 19:01:38 +00:00
< link rel = "stylesheet" type = "text/css" href = "../help.css" >
2003-11-28 21:50:02 +00:00
< / head >
< body >
2004-06-02 19:01:38 +00:00
< h1 > Building C/C++ projects< / h1 >
2003-11-28 21:50:02 +00:00
2004-06-24 10:49:13 +00:00
< p > The CDT relies on an external make utility, such as GNU make, to build a project.
2004-06-02 19:01:38 +00:00
The CDT can generate makefiles automatically when you create a Managed Make C project or a Managed Make C++ project.
2004-06-24 10:49:13 +00:00
You have the option of creating a Standard Make C project or a Standard Make C++ project and providing the makefile yourself.< / p >
2003-11-28 21:50:02 +00:00
< h2 > Required utilities< / h2 >
2004-06-24 10:49:13 +00:00
< p > You must install and configure the following utilities:
2003-11-28 21:50:02 +00:00
< ul >
2004-06-24 10:49:13 +00:00
< li > Build (e.g. make).< / li >
< li > Compile (e.g. gcc).< / li >
< li > Debug (e.g. gdb).< / li >
2003-11-28 21:50:02 +00:00
< / ul >
2004-06-24 10:49:13 +00:00
< b > Note: < / b > while make, gcc and gdb are the examples used in the documentation, virtually any similar set of tools or utilities could be used.< / p >
2003-11-28 21:50:02 +00:00
2004-06-24 10:49:13 +00:00
< p > < b > Tip: < / b > Cygwin contains these utilities (make, gcc and gdb) for a Windows environment, while running the cygwin installation ensure < tt > gcc< / tt > and < tt > make< / tt > are selected, they are not installed by default.
2004-06-02 19:01:38 +00:00
For more information, see < a href = "http://www.cygwin.com" > http://www.cygwin.com< / a > . Red Hat users, all you need to build your project is included in the Red Hat Linux installation.
For other operating systems please refer to your installation documentation.< / p >
< / p >
2003-11-28 21:50:02 +00:00
< h2 > Build terminology< / h2 >
< p > The CDT uses a number of terms to describe the scope of the build. < / p >
< h3 > Build Project< / h3 >
2004-06-21 10:33:03 +00:00
< p > This is an incremental build (make all, assuming all is defined in your makefile). Only the components affected by modified files in that particular project are built.< / p >
2003-11-28 21:50:02 +00:00
< h3 > Rebuild Project< / h3 >
2004-06-21 10:33:03 +00:00
< p > Builds every file in the project whether or not a file has been modified since the last build. A rebuild is a clean followed by a build.< / p >
2003-11-28 21:50:02 +00:00
< p > For more information on builds, see:< / p >
< ul >
< li > < b > Workbench User Guide > Concepts > Workbench > Builds< / b > < / li >
< li > < b > Workbench User Guide > Tasks > Building resources< / b > < / li >
< / ul >
< p > Build-related information is displayed as follows:< / p >
< ul >
2004-06-24 10:49:13 +00:00
< li > The Console view displays the output of the build tools.< / li >
2004-06-21 10:33:03 +00:00
< li > The Tasks view displays a list of compiler errors and warnings related to your projects.< / li >
2005-07-18 02:20:39 +00:00
< li > For Standard Make projects, the Makefile targets are displayed in the Make Targets view.< / li >
2003-11-28 21:50:02 +00:00
< / ul >
2004-06-21 10:33:03 +00:00
< p > For more information about the Tasks view, see < b > Workbench User Guide > Reference > User interface information > Views and editors > Tasks view< / b > .< / p >
2003-11-28 21:50:02 +00:00
2004-06-02 19:01:38 +00:00
< h2 > Getting a makefile< / h2 >
2003-11-28 21:50:02 +00:00
2004-06-24 10:49:13 +00:00
< p > You can either create a C/C++ project for which you supply the < b > makefile< / b > or create a C/C++ project for which the CDT generates makefiles automatically.< / p >
2003-11-28 21:50:02 +00:00
2004-06-21 10:33:03 +00:00
< p > To create a new project, from the menu bar choose < b > File > New > Project< / b > . In the dialog that appears:< / p >
2003-11-28 21:50:02 +00:00
2004-06-02 19:01:38 +00:00
< ul >
2004-06-21 10:33:03 +00:00
< li > To create a project for which you supply the < b > makefile< / b > , select either < b > Standard Make C project< / b > or < b > Standard Make C++ project< / b > . < / li >
< li > To create a project for which the CDT supplies a basic < b > makefile< / b > , select either < b > Managed Make C project< / b > or < b > Managed Make C++ project< / b > . < / li >
2004-06-02 19:01:38 +00:00
< / ul >
2003-11-28 21:50:02 +00:00
2004-06-02 19:01:38 +00:00
< h2 > Setting build preferences< / h2 >
< p > You can set build preferences in Eclipse:< / p >
< dl >
2004-06-21 10:33:03 +00:00
< dt > Build order< / dt >
< dd > If certain projects must be built before others, you can set the < i > build order< / i > .
If your project refers to another project, the CDT must build the other project first.
To set the build order, from the menu bar select < b > Window > Preferences > Build Order< / b > .
< p > When you set the build order, the CDT does not rebuild projects that depend on a project;
you must rebuild all projects to ensure all changes are propagated.< / p > < / dd >
< dt > Automatic save< / dt >
< dd > You can set the CDT to perform an < i > automatic save< / i > of all modified resources when you perform a manual build;
from the menu bar, select < b > Windows > Preferences > Workbench< / b > .By default, this feature is enabled.< / dd >
2004-06-02 19:01:38 +00:00
< / dl >
< h2 > Controlling the building of your project< / h2 >
2005-07-18 02:20:39 +00:00
< p > For a Standard Make project, the C/C++ compiler that a project uses is controlled by the project's < b > Properties< / b > setting.
2004-06-21 10:33:03 +00:00
To view a project's properties, right-click on the project and select < b > Properties< / b > .
2004-06-24 10:49:13 +00:00
In the dialog that appears, the < b > C/C++ Standard Make Project< / b > page enables you to control a variety of settings, including:< / p >
2004-06-02 19:01:38 +00:00
< dl >
2004-06-21 10:33:03 +00:00
< dt > Build Setting< / dt >
< dd > Controls whether the compiler will < b > Stop On Error< / b > or < b > Keep Going On Error< / b > .
Choosing < b > Keep Going On Error< / b > will force the compiler to attempt to build all referenced projects even if the current project has errors.< / dd >
< dt > Build Command< / dt >
< dd > Controls which make is used.< / dd >
< dt > Workbench Build Behavior< / dt >
< dd > Controls which makefile target will be built depending on the scope of the build.< / dd >
2004-06-02 19:01:38 +00:00
< / dl >
2005-07-18 02:20:39 +00:00
< p > For a Managed Make project, the project properties dialog enables you to manage the build configurations of your project. For additional information see:< / p >
< ul >
< li > < b > Reference > C/C++ Project Properties > Managed Make Projects< / b > < / li >
< li > < b > Reference > C/C++ Project Properties > Managed Make File Properties< / b > < / li >
< / ul >
2004-06-02 19:01:38 +00:00
< h2 > Viewing build information< / h2 >
2004-06-21 10:33:03 +00:00
< p > Build-related information is displayed as follows: < / p >
2004-06-02 19:01:38 +00:00
< ul >
2004-06-21 10:33:03 +00:00
< li > The < b > Console< / b > view displays the output of the make utility.< / li >
< li > The < b > Tasks< / b > view displays a list of compiler errors and warnings related to your projects. < / li >
2005-07-18 02:20:39 +00:00
< li > For a Standard Make project, build actions display in the < b > Make Targets< / b > view.< / li >
2004-06-02 19:01:38 +00:00
< / ul >
2004-06-21 10:33:03 +00:00
2003-11-28 21:50:02 +00:00
< p > < img border = "0" src = "../images/ngconcepts.gif" ALT = "Related concepts" width = "143" height = "21" >
< br >
< a href = "cdt_c_projects.htm" > CDT Projects< / a > < br >
< a href = "cdt_c_proj_file_views.htm" > Project file views< / a > < / p >
< p > < img border = "0" src = "../images/ngtasks.gif" ALT = "Related tasks" width = "143" height = "21" >
< br >
< a href = "../tasks/cdt_o_build_task.htm" > Building< / a > < / p >
2005-07-18 02:20:39 +00:00
< p > < img border = "0" src = "../images/ngref.gif" ALT = "Related reference" width = "143" height = "21" >
< br >
< a href = "../reference/cdt_u_properties.htm" > Project Properties< / a > < / p >
2004-06-02 19:01:38 +00:00
< p >
2004-06-24 10:49:13 +00:00
< img src = "../images/rh03_04.gif" ALT = "Red Hat Copyright Statement" > < br >
< img src = "../images/ng00_04a.gif" ALT = "IBM Copyright Statement" >
2004-06-02 19:01:38 +00:00
< / p >
2003-11-28 21:50:02 +00:00
< / body >
< / html >