How to setup C/C++ in NetBeans 6.9.1

This article is a step-by-step tutorial to help you set up C/C++ in your NetBeans 6.9.1 IDE on your openSUSE 11.2 OS. These instructions should be easy to modify for any GNU/Linux-based OS too!

Things You’ll Need

  • NetBeans 6.9.1 – The Smart Way to Code
  • openSUSE 11.2 (But any GNU/Linux-based OS will do!)
  • A Terminal window

First Steps…

Let’s install the required tools from the GNU Compilers Collection. Here is a list of tools that you’ll need:

  • C Compiler: gcc
  • C++ Compiler: g++
  • Assembler: as
  • Make Command: gmake
  • Debugger Command: gdb
  • CMake Command: cmake (I think this one is optional; but I’m not sure! So let’s install it anyway!)

At your terminal window, enter the following command,

sudo zypper install gcc gcc-c++ binutils gmake gdb cmake

zypper is the package manager used by openSUSE 11.2 at the terminal. For Ubuntu, you might have to enter something like,

sudo apt-get install gcc gcc-c++ binutils gmake gdb cmake

I’m not sure, just check on the Internet.

Moving on, enter your root password and let zypper (or your package manager) install the necessary packages.

Setting up NetBeans…

Once you’re done, follow the steps below:

  1. Open your NetBeans IDE and goto Tools > Options.
  2. Click on the C/C++ tab.
  3. You should see a window similar to the one below, but with empty fields.
  4. Click on the Add… button near the bottom-left corner.
  5. Enter the Base Directory as /usr/bin and press the Tab key.
  6. NetBeans will automatically select the Tools Collection name as GNU from the combo-box.
  7. Enter a nice name at the Tools Collection Name like GNU Compiler Collection or something.An image showing the NetBeans - Add New Tools Collection window.
  8. Click OK.
  9. Your Options window should now look similar to the Options window image shown above (after step 3.)
  10. Congratulations, your NetBeans IDE should now be ready to run C/C++.

Further help…

Comment back here if you need any help regarding this. I’d be happy to help!

Happy Programming!

If you have any suggestions for improvements, please comment!

9 responses to “How to setup C/C++ in NetBeans 6.9.1

  1. Hi Rishabh,

    Very nice description – short and correct!
    You are right, cmake is not needed, unless you have a project that needs it.
    BTW, there is another way – you can install Oracle Solaris Studio, which includes
    Netbeans 6.9.1, C/C++/Fortran compilers (including assembler), dbxtool, dmake,
    Performance Analyzer and many other useful things. Here is the web page:
    In this case you get all tools at once, and if you see any problem – there is a web
    page where you can get help:


    • Hi,

      Thank you, Nikolay! Yes, I remember now, I had installed cmake separately for compiling and building another unrelated application. Thanks for the info about Oracle Solaris Studio, I’ll go through it.


  2. inthe base directory after typing user\bin and tab netbeans is not automatically selecting the Tools Collection name as GNU from the combo-box. was da problem ? n moreover cygwin is installed in my pc but in cmd after typing cygcheck -c cygwin its not working …plzzz help………

  3. I am having a hard time remembering what switches I used to get netbeans to see crypt.h under /usr/includes/crypt.h . I have the directory in my listing, but it refuses to see them and hence won’t compile my code.

    what should I use to make this include visible to the IDE?
    I have the following on the Fedora 14 system:
    /usr/include //this is where crypt is located!!!

    I have the same on my mandriva system and all works fine, excluding the fact that netbeans still sees it as undefined, but it will compile since the compiler is recieving the right includes.

    The opposite is the case on my fedora 14 box. It doesn’t mind my includes, but refuses to find the reference within the includes for /usr/includes/crypt.h

    Any suggestions would be nice because this inconsistency of setup is really a freaking pain. There is nothing else for me to include in the “highlighting” tab. There is no where else on the system to look for includes so why doesn’t this work?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s