corner imagecorner image
FeaturesPluginsDocs & SupportCommunityPartners

Defining Your C/C++ Project's Development Environment

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.

Contents

Content on this page applies to NetBeans IDE 6.7

Requirements

To follow this tutorial, you need the following software and resources.

Software or Resource Version Required
NetBeans IDE version 6.7 with NetBeans C/C++ plugin
Java Developer Kit (JDK) version 6 or version 5

See the NetBeans IDE 6.7 Installation Instructions for information on downloading and installing the required software.

Installing Tool Collections

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.

See Configuring the NetBeans IDE for C/C++/Fortran for instructions on installing and configuring the required tools.

Specifying the Development Host

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.

See the C/C++ Remote Development Tutorial for more detailed information about the remote host requirements.

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.

  1. Select the project node in the Projects window.
  2. Right-click the project node and select Set Remote Development Host from the pop up menu.
  3. Select the remote host you want to use, or select Manage Hosts to add a new host.

Adding a Remote Development Host

  1. Choose Tools > Options.
  2. Click C/C++ in the top pane of the Options dialog box.
  3. On the Build Tools tab, click Edit next to the Development Host drop-down list.
  4. 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.
  5. 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.


  6. Image showing the Process of Adding New Host for Remote Development.

  7. On the Setup Host screen, type the username and password that you use to log in to the remote host, and click Next.


  8. Image showing the Process of Connecting to the Remote Development Host.

  9. 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.
  10. 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.
  11. 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.

  12. 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.

    Image showing the Completion of Adding a New Host for Remote Development.



  13. 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.


  14. Image showing the Path Mapping window.

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:

  1. Select the Development Host where you want to add a tool collection.
  2. Click Add under the Tool Collection list.
  3. 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.

  4. 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.



  5. 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:

  1. Right-click the project in the Projects window and choose Properties.
  2. In the Project Properties dialog box, select the Build node in the Categories list.
  3. In the build tools properties, make sure the Development Host is set to the host you want to build on.
  4. Select a collection from the Tools Collection dropdown list .

  5. Screenshot of Build panel of Project Properties dialog

  6. Click OK.
  7. The next time you build the project, the selected tool collection will be used.