blob: f9081e86469314302b85d6a97a94989d298e73bb [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Defining Your C/C++ Project's Development Environment</TITLE>
<meta name="KEYWORDS" content="NETBEANS, TUTORIAL, C/C++, tools">
<meta name="DESCRIPTION" content="Short tutorial that demonstrates using
local or remote tool collections to develop C/C++ projects in NetBeans IDE">
<meta name="author" content="Ann Rice">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<link rel="stylesheet" type="text/css" href="../../../netbeans.css">
</head>
<body>
<a name="top"></a>
<h1>Defining Your C/C++ Project's Development Environment</h1>
<!-- START INTRO ---------------------------------------------------------------------------------------* -->
<div class="articledate" style="margin-left: 0px;font-style:italic;">
<p><em>Contributed by <i>Ann
Rice</i> and maintained by
<i>Susan Morgan</i><br>
June 2010</em> [Revision number: V6.9-1]</div>
<p>The following short tutorial takes you through the basic
steps of selecting the development host and tool collection for building and
debugging a C or C++ project in NetBeans IDE.
</p>
<!-- END INTRO -->
<p><b>Contents</b></p>
<img src="../../../images_www/articles/70/netbeans-stamp-70-71-72.gif" class="stamp"
alt="Content on this page applies to NetBeans IDE 6.9, 7.0, 7.1 and 7.2" title="Content on this page applies to the NetBeans IDE 6.9, 7.0, 7.1 and 7.2">
<ul class="toc">
<li><a href="#requirements" title="Requirements">Requirements</a></li>
<li><a href="#installing" title="Installing Tool Collections">Installing Tool
Collections</a></li>
<li><a href="#host" title="Specifying the Development Host">Specifying the
Development Host</a></li>
<li><a href="#using" title="Using the Tool Collection List">Using the Tool Collection List</a></li>
<li><a href="#changing" title="Changing the Tool Collection for a Project">
Changing the Tool Collection for a Project</a></li>
</ul>
<h2><A NAME="requirements"></a>Requirements</h2>
<p><b>To follow this tutorial, you need the following software and resources.</b> </p>
<table>
<tbody>
<tr>
<th class="tblheader" scope="col">Software or Resource</th>
<th class="tblheader" scope="col">Version Required</th>
</tr>
<tr>
<td class="tbltd1">NetBeans IDE</td>
<td class="tbltd1"><a
href="https://netbeans.org/downloads/index.html">version 6.9, 7.0, 7.1 or 7.2 with NetBeans C/C++ plugin</a></td>
</tr>
<tr>
<td class="tbltd1">Java Developer Kit (JDK)</td>
<td class="tbltd1"><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">version 6 or 7</a></td>
</tr>
</table>
<br>
<p>See the <a href="../../../community/releases/72/install.html">NetBeans IDE
7.2 Installation
Instructions</a> for information on downloading and installing the required software.
</p>
<h2><a name="installing"></a>Installing Tool Collections</h2>
<p>The Netbeans C/C++ module minimally requires a C compiler, C++ compiler, make utility, and
gdb debugger.
See <a href="../../../community/releases/69/cpp-setup-instructions.html">
Configuring the NetBeans IDE for C/C++/Fortran</a> for instructions on
installing and configuring the required compilers and tools.
<h2><a name="host"></a>Specifying the Development Host</h2>
<p>You can build, run, and debug your project on the local host (the system
from which you started the IDE) or on a remote host running a UNIX&reg;
operating system. Only the Solaris and Linux operating systems have been
tested as remote development hosts. Initially, the IDE is set up to use the
local host only.</p>
<p>You can define remote development hosts in the Build Tools tab of the C/C++
panel of the Options window, as described in the
<a href="./remotedev-tutorial.html">C/C++ Remote Development Tutorial</a>.
</p>
<h2><a name="using"></a>Using the Tool Collection List</h2>
<p>The tool collection list is in the Tools &gt; Options &gt; Build Tools tab. The
list displays the collections found on the currently selected development
host. The default collection is listed in bold type, and is selected for any
new project you create. You can change the
tool collection for a specific project in the project properties.</p>
<p>The tool collection is associated with the development host, so you must
be sure the correct development host is selected before working with the
tool collection list. For local or remote hosts, you can modify the
Tool Collection list by adding or removing collections.</p>
<h3>Changing the Default Tool Collection</h3>
<p>To change the default tool collection, select a collection from the Tool Collection list
and click Default. The new default tool collection will be selected for any new projects
you create using the selected development host.
</p>
<h3><a name="adding"></a>Adding a Tool Collection to a Development Host</h3>
<p>When you add a tool collection, you make the compilers available to the IDE. The tools
must be installed on the system already.</p>
<p>To add a tool collection associated with a development host:
<ol>
<li>Select the Development Host where you want to add a tool collection.
</li>
<li>In the Tools &gt; Options &gt; Build Tools tab, click Add under the Tool Collection list.</li>
<li>In the Add New Tool Collection dialog box, type the directory path for
the tool collection's executable files in the Base Directory field, or use the Browse button to navigate to the
directory.
<p class="notes">Note that in NetBeans IDE 6.7 and 6.8, if the Development Host is not localhost, the Browse feature is not
available. You must type the complete path to the base directory of the tools on
the remote server. Click Check to have the IDE check that the path you have entered
is valid for a supported tool collection. You might be prompted to log in to the server
to check the path. In NetBeans IDE 6.9, the Browse feature is available for remote hosts.</p>
</li>
<li>The Tool Collection Family and Tool Collection Name are filled in automatically for
valid paths. You can specify a
different name for the collection. If you change the family to another family on the
dropdown list, make sure that the family you specify is the correct family for the
collection or the compiler flags might not be valid.
<br>
<img src="../../../images_www/articles/72/cnd/development-environment/add-collection.png" alt="screenshot of Add New Tool Collection dialog box">
</li>
<li>Click OK.</li>
</ol>
<h2><a name="changing"></a>Changing the Tool Collection for a Project</h2>
<p>When you create a project, the current default tool collection is selected as the tool
collection for the project. You can change the tool collection for your project to another
collection on the collection list, or you can customize a tool collection especially for
the project.
<p>To select a different tool collection for an existing project:</p>
<ol>
<li>Right-click the project in the Projects window and choose Properties.</li>
<li>
In the Project Properties dialog box, select the Build node in the Categories list.
</li>
<li>In the build tools properties, make sure the Development Host is set to the host you want to build on.
</li>
<li>Select a collection from the Tools Collection
dropdown list.
<br>
<img
src="../../../images_www/articles/72/cnd/development-environment/select-collection.png"
alt="Screenshot of Build panel of Project Properties dialog">
</li>
<li>Click OK.</li>
</ol>
<p>The next time you build the project, the selected tool collection will be used.</p>
<p>
<h2>See Also</h2>
<p>Please see the
<a href="https://netbeans.org/kb/trails/cnd.html">C/C++ Learning Trail</a> for
more articles about developing with C/C++/Fortran in NetBeans IDE.</p>
<div class="feedback-box"><a href="mailto:users@cnd.netbeans.org?subject=Feedback:%20Defining%20Your%20C/C++%20Project's%20Development%20Environment%20-%20NetBeans%20IDE%206.7/6.8/6.9%20Tutorial">Send Feedback on This Tutorial</a></div>
</BODY>
</HTML>