Getting started with netbeans

Netbeans is a very powerful IDE. These pages are intended to get you started. The help-facility of netbeans is comprehensive and will give you further information.

Because the version 6.1 used by default in the School does not have the C/C++-extension installed, we need to use the newer version. This is reachable via the command-line - simply type /bham/common/java/packages/netbeans-6.5/bin/netbeans & at a command-line prompt.

The first step is to set the additional compiler flags which ensure that all warnings are produced and are treated as errors. For this, select Tools-> Options , and in the window which appears, the option C/C++ . Now enter in the text box marked Make Options the text "-Wall -Werror" (including the quotes). This window should now look like

To create a new project, open File-> New Project . Select "C/C+" as the category, and "C/C++ Application" as the Projects. After these steps you should get a screen that looks like
New Project layout
In the next step you will be asked for a name of the project. Choose whatever suits you.

You create a new source file with the main-fucntion already provided by right-clicking on the "Source Files"-item of the project and selecting New-> Main C File . In the resulting screen choose a suitable name, normally the name of the project. You can now start entering your source code. The program for the Hello-World-example looks like this:

To compile the program, select Run-> Build Main Project . All compiler errors are shown in a separate window at the bottom.

To run the program, open Run-> Run Main Project. A separate window will appear, which contains the input and output of the program. The debugger is started and used in the same way as for Java-programs.