Defining Your C/C++ Project's Development Environment
Contributed by
and maintained by
June 2009 [Revision number: V6.7-2]
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 6.7.
The Netbeans C/C++ module minimally requires a C compiler, C++ compiler, make utility, and
gdb debugger. The NetBeans C/C++ module has been tested with the compilers
and tools listed in C/C++ Tool Collections Tested with NetBeans IDE.
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®
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.
To develop a project on a remote host:
You must have permission to log in to the host using ssh, a secure
shell utility that is available on all platforms supported by the NetBeans IDE.
The project files
must be accessible to the local host and the remote host. This can be
accomplished by keeping the project files on a shared filesystem that is visible
on the local host and the remote host, or by allowing the IDE to securely
copy the project files from the local host to the remote host.
You can define remote development hosts in the Build Tools tab of the C/C++
panel of the
Options window, as described in Adding a Remote Development Host.
Setting a Project to Use a Remote Development Host
When you create a project, the default development host is selected
as the development host for the project. If you have not set up a remote development host
the default host is the local host.
If you have added a remote host, you can set up a project to use it as follows.
Select the project node in the Projects window.
Right-click the project node and select Set Remote Development Host from the pop up menu.
Select the remote host you want to use, or select Manage Hosts to add a new host.
Adding a Remote Development Host
Choose Tools > Options.
Click C/C++ in the top pane of the Options dialog box.
On the Build Tools tab, click Edit next to the
Development Host drop-down list.
In the Development Hosts Manager dialog box, click Add.
In the New Remote Development host dialog box, the IDE discovers your
network's hosts. The host names are added to a table in the dialog box,
and marked Available if they are running the SSH server.
Double-click the name of the server you want. You can also type a server name in the Hostname field
if you prefer. Click Next.
On the Setup Host screen, type the username and password that you use to log in to the remote host, and click
Next.
The output shows the IDE's attempt to connect to the server and locate a tool collection.
When the host is successfully configured, click Next. The IDE connects to the remote host and finds
tool collections.
The Summary page shows information about the
remote host, including the platform, hostname, username used to log in, and toolchains found.
You can change the display name, which is the label used for the host
in the IDE.
The Summary page also enables you to change the default toolchain and the synchronization
method used for this server. The synchronization method specifies whether the IDE should
use a shared file system or securely copy the project files for use on the remote server.
Note that some server information is copied to the local host, as indicated
by a progress bar and a message "Preparing Code Model for host" in the main IDE window.
Click Finish, and you return to the Development Hosts Manager. You can click Path Mapper... to
view and if necessary correct mappings for the shared source location on the local and remote hosts.
Note that each path is the path to the shared source as seen from the respective hosts. If you need to edit
either the local or remote path, double-click the path you want to change and type the new path.
Click OK to exit the Path Mapping dialog box.
Using the Tool Collection List
The tool collection list in the Build Tools tab of the Options dialog box
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.
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.
Changing the Default Tool Collection
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.
Adding a Tool Collection to a Development Host
To add a tool collection associated with a development host:
Select the Development Host where you want to add a tool collection.
Click Add under the Tool Collection list.
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.
Note that 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.
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.
Click OK.
Changing the Tool Collection for a Project
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.
To select a different tool collection for an existing project:
Right-click the project in the Projects window and choose Properties.
In the Project Properties dialog box, select the Build node in the Categories list.
In the build tools properties, make sure the Development Host is set to the host you want to build on.
Select a collection from the Tools Collection
dropdown list .
Click OK.
The next time you build the project, the selected tool collection will be used.