Thursday, April 19, 2007

NetBeans 5.5 as an excellent C/C++ IDE for Linux

There are several ways to program and develop C/C++ applications under Linux. Here are a few of them:

  • Use a simple text editor (Kate for example) for code writing, and running the gcc (for compliation) and gdb (for debugging) with needed paramters inisde the Terminal window. Well, this is really not a comfortable way to program things, but works with no problems.
  • Popular IDEs such as XEmacs and KDevelop, which I'm not so fimiliar with, but I heared only good things regard them.
  • NetBeans by Sun Microsystems (freeware) in it's Linux version. A really powerful, nice and easy to use IDE with a similar user interface as the Windows version.
But hey! Isn't NetBeans is an IDE for Java programming?! Well, basically it is, but it has several intersting extension modules and one of them is the C/C++ programming add-on.

Click to enlarge

Screenshot of the C/C++ IDE in NetBeans 5.5
(Windows version, but similar to Linux...)

Advantages

  1. Currently, the latest version of NetBeans is 5.5 and it has an excellent user interface. Everyone who familiar with NetBeans 5.5 for Windows will feel at home when using NetBeans 5.5 for Linux. Newbies will quickly get the drift (of course previous acquaintance with Visual Studio IDE and alike is an advantage).
  2. It has an easy compiler, debugger and other runtime settings configuration manager. You want to compile with the gcc? No problem. You want to use Sun's compiler for C/C++? It's easy to set! Want to determine warning levels? 64bit mode output? Debug on demand? Really, a piece of cake!
  3. It is a very stable environment. I ran it under Ubuntu 6.10 and it has never crashed (so far...). Even when I accessed an unauthorized memory section again and again...

Installation

Even the installation process is very simple (OK, I know I'm starting to sound like and advertiser, but I'm completely not).
Generally, You must have an installed version of JDK (version 5 or higher) before you can install NetBeans 5.5. So:

  • If you don't have JDK in your machine, you will want to download this version, which is the "Java SE Development Kit and NetBeans IDE Cobundle (JDK 6u1 / NB 5.5)". The instalation file is something about 142MB.
  • If you do have previous installation of JDK, just download the NetBeans 5.5 IDE from here (note that other languages are available). The file size is 55MB.

The file is of "bin" format and in order to install it, you just need to drop it inside a Terminal window (don't forget the "sudo" prefix!). Shortly, a graphical wizard will be open and the rest will be straightforward.

Now, after the installation was completed successfully, you need to install the C/C++ add-on module. Only after this installation you'll be able to start programming and compile your C/C++ applications with NetBeans. Download the Linux version for the C/C++ add-on from here. Again, just drop this "bin" file in the Terminal window and the next will be straightforward. Good luck!

4 comments:

Kati-Kati Africa Ltd said...

Nice post, Good knowledge and explanation for the programmers on language...keep posting important things like this...will come back to this blog for sure to read more.


Here's my little site I'm gonna blog about Vehicles

balmeyer said...

I'm so agree with you ! I was very impressed by the "C/C++ Pack".

Stephen said...

I can't seem to get my c++ projects to run in netbeans. That is whether i run or debug, no terminal pops up with the programs output. I'm using GNU compiler and I can run the executable manually from the command line, but netbeans doesnt seem to execute it.

Jacob Barkai said...

Interesting behaviour of netbeans on this case... Have you checked that the project's properties are all set appropriately?
Try to right click the project name and select "Properties" from the popup menu (the last one). Then verify the following settings:

1. Under the "General" branch -
Compiler Collection is "GNU Compiler Collection", Platform is "Linux x86" and Configuration Type is "Application" (I suppose you wanna an executable, right?).

2. Under the "Running" branch -
The last two settigns, "Console Type" and "Terminal Type" should be set to the wanted application which performs as the output window. Normally it will be set to "Default", but you may play with the other options in order to solve the problem.

3. Under the "Debugging" branch -
Just check the "Tool" setting displays a vaild debugging tool. I'm using "gdb".

4. Under the "C/C++" > "GNU C Compiler" > "General" branch -
the "Include Directories" setting should contain a valid path to the common included header files (i.e. stdlib.h, stdio.h files etc.). I have those headers under "/usr/include". Also, verify the "64 Bit Architecture" to be unchecked.

Hope this detailed tip will solve the problem...