Susheel's Blog

Netbeans for C++?

by on Jan.24, 2009, under Programming & Development, Software

I am a sucker for IDEs and I have been meaning to take Netbeans out for a test ride for sometime now. I have been hearing a lot of good things about Netbeans every since version 6.0 came out and more so ever since the version 6.5 arrived. OK before I proceed further, let me point out the fact that I have been using Netbeans for C++ development and have never used the IDE for anything other than C++. So my comments may be somewhat inaccurate for other languages.

For one the IDE seems to be solidly built and you can find your way around the place easily. Everything is where it should be and there is no second guessing as to what functionality a particular window, menu item or an option provides. Clean and sweet. Netbeans has probably the cleanest interface among IDEs. This is probably the strongest points about the IDE and given the fact that it is available on multiple platforms, means it could be used by people who do cross platform development.

I ran the IDE on Windows using the MinGW and MSYS systems, and it wasn’t very difficult to setup given that I already had MinGW and MSYS setup. The build system for the IDE is via your native Makefiles (*shiver*). I severely dislike the taste of Makefiles; especially maintaining them for large, cross-platform projects that have multiple dependencies. But the IDE manages Makefile issues nicely and I can live with that.

For those who don’t already know, Netbeans is actually a framework and a platform to build applications. The IDE is an application built on top of this platform. The strength of the Netbeans platform is it’s ability to have modules. Platform modules are basically Java classes that interface with Netbeans open API. The IDE also, can be extended via modules to add and enhance functionality. An open API like that also means Netbeans can be turned into almost any type of IDE by simply programming in functionality for a language.

The IDE has an excellent code completion feature, and I have to say it is surprisingly fast. The intellisense of the IDE  is top notch, probably better than most free IDEs out there, including my current hot favorite, Code::Blocks. I would even go as far as saying that in some situations it is better than even Visual Studio Express. The Navigator and the class display windows are pretty snappy. Any addition or change made to the code is updated very very quickly. On the intellisense front, it deserves a 7 on 10. The real-time syntax checker also deserves a praise. Oh how I miss these things in VS Express :-( !! Small things go a long way in enhancing productivity and Netbeans is by far the best among the free IDEs in that regard.

Netbeans has a lot of modules using which you can extend the functionality of the IDE and the community support is equally good. I would seriously recommend this IDE to all those who want a free IDE for C++. Netbeans by default supports only the GNU toolset, meaning you won’t be able to use compilers from Microsoft, Intel, Borland and others. The debugger used is gdb but the display and setup of the debugging GUI under the IDE can probably rival any other IDE for completeness.

So what’s to complain? Nothing really; but, just to nitpick, the fonts look a bit messy. There is no hinting on the fonts and it does look a bit drab. No hinting also means I have to use a higher font size than I normally do under VS and Code::Blocks. Talking about Code::Blocks, for me C::B still edges out in front of Netbeans just because it has a build-in GUI designer for wxWidgets, and well Netbeans dosen’t but that is probably just for me. I hope someone writes one soon :-D . Netbeans is too good an IDE to ignore. However, I must say, I am impressed with Netbeans. It sure seems OSS IDEs are rapidly closing the gap between commercial ones.


23 Comments for this entry

  • yostane

    you forgot to mention that codeblocks has an advantage with project templates which don’t work well on netbeans c++

  • susheel

    Yeah they do, but Project templates are just a stater. I am not saying they are not important, but most of the time you could do without them. I usually don’t use them because I generally work on large projects that have little or no use of templates.

    Even without those Netbeans is still a great IDE for C++.

    Well C::B can be used with a lot of different C++ compilers, Netbeans can’t, but this is not a comparison between C::B and Netbeans! It was never meant to be. I just wanted say that Netbeans is a really good IDE even for C++.

    I am still a C::B Fan :-D . But I am equally impressed by Netbeans.

  • Dave G

    I prefer Netbeans for the Intellisense. I can’t seem to get Code::Blocks to show all inherited members and functions, but I may be doing something wrong. It just seems to work right in Netbeans.
    I am using wxFormBuilder and it seems to do a good job for GUI bulding and is a nice replacement for wxSmith in Code:Blocks.

  • p

    About code completion: you should try VS with Visual Assist X. IMHO such functionality should be goal for NB developers.

  • susheel

    Yes but Visual assist is neither free nor open source. I have used Visual Assist for many years and no doubt it is a great tool, but Netbeans comes close, — and I can assure you it is pretty close to VS+Visual Assist.

  • artworx

    On Linux and Solaris the Sun Studio compiler ide is built on Netbeans and has a lot more features then plain Netbeans C++ like Thread Analyzer and Performance Analyzer

  • Name

    Let me put the good things first:
    – Yes, NetBeans has good C++ support
    – Yes, the GUI is OK
    – Yes, at first glance, code completion is fast and accurate
    .

    But, it is NOT suitable for development of large projects because it is slow:
    – Any functionality drawing data from actual code (code completion, go to type, show method signature, …) in large projects is slow. In addition, it is totally unpredictable whether a particular request for code completion will actually succeed or will fail.
    – The C++ re-parser is *highly* inefficient. This makes the consequences of saving a file to disk very painful.
    .

    Therefore, contrary to what some self-proclaimed “expert” may be saying, do NOT use NetBeans 6.0/6.5 for large C++ projects.

  • susheel

    @Name
    Fine you are entitled to your opinion. But just to put the facts straight I did include a big project and I found the IDE to be surprisingly fast. I tried wxWidgets and given all the classes wxWidgets has, it was pretty damm fast (and accurate) at code completion for even for large class with lots of methods. This on a 3 year old Intel dual core machine. Are you sure you are using the latest version? I guess the older versions were a bit slower.

    I am not saying the IDE flawless, I am just saying it’s pretty good given that’s it free and cross-platform.

  • Name

    I agree on one thing: NetBeans is the best free IDE. But what you’re saying simply isn’t true. Please consider doing the following procedure (as I just did) to test a big project (wxWidgets itself):
    – download wxGTK from http://prdownloads.sourceforge.net/wxwindows/wxGTK-2.8.9.tar.gz
    – extract it to some temporary directory, run “./configure”
    – create a new project in NetBeans 6.5 using existing Makefile from wxGTK sources. Set “Project – Properties – Code assistance – C++ – Include directories” to “YOURPATH/wxGTK-2.8.9/include”. Wait until the parser finishes its job (approx. 1 minute on my computer).
    – Open file “control.cpp”. Go to line 1905 with text “msg.Printf(“. Put your cursor just after the “.” and press Control+Space to perform code-completion. Yeah, I get a snappy answer saying “No suggestions”. You can now browse the source code to find out more about the type of the variable “msg”. I did and found out that NetBeans 6.5 behaves like a total idiot in this case. So much for “accuracy of code completion”. With more “hands-on” experience with NetBeans, you will also probably notice the erratic nature of code completion – I have no clue as to what causes such inexplicable code completion failures, sometimes it works sometimes it does not.
    – Now, the speed. I normally work with a project whose total size is smaller than wxGTK. Despite this, the parser is consuming huge amount of CPU cycles – the total CPU time consumed by NetBeans’ parser threads is always at the top of the list of CPU times consumed by processes running on my computer. I resorted to manually lowering their priority, because they were getting in the way of the C++ compiler (gcc) which was running at only 1/2 or 1/3 of its normal speed because of NetBeans processes. (I have a dual-core processor).
    – I noticed that speed of re-parsing seems to depend on the source code, so for some projects it may be fast, while for other projects using other language features it may be end up being slow. So one cannot just conclude that “because I tested NetBeans on project X and it was fast”, therefore “if I test it with a different project Y, it will be fast well”. It seems to depend on the project, though I have no idea which C++ features make it go slow.

  • Adam Jorgensen

    @Name: It seems you’ve done some pretty extensive testing. My advice is that you file bugs with the NetBeans support system detailing your issues. I’ve generally found the NetBeans team responds pretty quickly to bugs and and enhancement requests.

  • Name

    @Adam Jorgensen: They know about it. Performance improvements seem to be on the roadmap for NetBeans 7.0. For example:
    http://wiki.netbeans.org/CND70Plans
    http://wiki.netbeans.org/CND70MacroSupport
    http://wiki.netbeans.org/CND70Performance

    We will see.

  • bitshifter

    My experience was similar to Name. I tried using it on the XBMC codebase (http://www.xbmc.org), NetBeans maxed out my CPU parsing the project for at least 30 minutes before I gave up and killed it.

    It’s a shame, it looked nice but didn’t scale that well. Eclipse on the other hand copes with XBMC, as does Kdevelop. From memory, I found the NetBeans bugger lacking in comparison to Eclipse, although I can’t remember what was missing. Perhaps a threads view?

  • aa

    Have you tried Eclipse CDT?
    If not just try once.
    I guarantee that it will not disappoint.

  • Name

    @aa: Just tried Eclipse CDT 5.0.1 (Version: 3.4.1, Build id: M20080911-1700) – and I am disappointed. Let me summarize it:
    (I turned on “Index all files” checkbox in file indexer’s settings)

    – Hovering over QFont in the codeline “QFont font = …;” pops up a panel containing the forward declaration of QFont, followed by the full definition of class QPainterPath. I would expect this kind of error from a 10 year old child, not from a supposedly “mature” C/C++ development environment.

    – After typing “.” or “->” after a variable, in “many cases” code completion simply does not work.

    – The most stupid thing I can see is the following: typing “.” after a parameter name pops up a window suggesting all parameter names. For example, if the parameters are (A a, B b, C c), Eclipse suggests the code “a.” to be continued with either ‘a’, ‘b’ or ‘c’! In addition, this gets popped up after any kind of expression, not such the parameters (though parameters are, in comparison to other aspects of C++, a simple parsing matter so I expected them to work flawlessly).

    – I see no qualitative difference between the “Fast C++ indexer” and “Full C++ indexer” (besides the latter being slower)

    In other words, Eclipse CDT handles C++ code like a moron. If it was commercial, I would immediately request my money back, but since it is free and open source – I’m just going to delete it from my disk and completely forget about it as being a better alternative to NetBeans.

  • Vasileios Anagnostopoulos

    The only stupid thing encountered on Mingw/Msys + Nebeans is that for the compiler I have to put -I/usr/local/include but for the autocompletion

    d:\winoss\msys\local\include

    I have already filled a bug. On the other hand it is a decent and I have only mingw/msys + Netbeans+Eclipse+Codeblocks + Ultimate++ on my laptop
    and I am satisfied. I use tdm gcc and hand-compiled libraries. No .lib only .a or .dll.a files. It is a viable solution for semi-professiona programming. For the Wxwidgets questions I suggest to use TCL/TK. Unfortunately the WinTclTk project does not provide .a files but you can use activetcl or create your own with pexport

  • aa

    As you think.
    I did not meet with these defects.
    But I have saw an error, which is critical , and only can be solved by deleting the cache. I think, when i set the includes path for my qt project, the code completion wasnt working it in netbeans(6.1 stable version).
    I reported to issues list. I guess the developers have already been fixed.
    Eclipse is more dynamically structured than the netbeans.
    Every plugins are have got settings page in an IDE.
    NetBeans does not support it.
    NetBeans is very good for beginner programmers.
    Eclipse is very good for advenced programmers .
    Because Eclipse more configurable than netbeans :)
    So the eclipse developers are consider when a version will be stable.
    Try the netbeans php editor :)
    Create a global instance from some class.
    After create a class and try your global object, the code autocompletion will not work it (Stable version) :)
    I can write other errors what are in the stable version.

  • Name

    @aa:
    – NetBeans 6.5 has some improvements in comparison to 6.1, though not as many as I would like
    – Historically, previous versions of NetBeans were much more configurable than the current version. The developers abandoned that approach because the provided configurability was to excessive. (I did miss some of the lost options, but it is possible to edit NetBean’s text-based configuration files for finer control over certain options). Maybe, in time, Eclipse will also “reinvent itself” and go the way of exposing a slightly lower number of options configurable through GUI.

  • Adriaan

    Can “Name” maybe recommend a free C++ IDE for linux (preferably cross-platform).
    I have just started developing on Linux and plan on using wxWidgets with a few other opensource libraries.
    So far I have tried CodeBlocks, Eclipse, Netbeans and other miscellaneous IDE’s.
    So far I like Netbeans most. I can just point it in the direction of most opensource project I want to work on and it usually just works with the makefiles.
    I dislike Eclipse – it’s just not intuitive for me.
    CodeBlocks seem a little basic… but I must admit I haven’t used it a lot yet…
    Another great + for Netbeans is that it supports the major version control systems like Mercurial, Subversion and CVS out the box.

  • susheel

    @Adriaan
    There is no really good answer to your question. Each IDE has it’s strengths and weaknesses. I personally prefer Code::Blocks since it has a fairly powerful built-in GUI editor and I do use wxWidgets a lot with my projects. Code::Blocks is a fairly powerful and feature rich IDE and it has a large and active community behind it. You can pick up the latest stable nightly build from their website and it should have a lot more than what is in the stable version.

    Reading your comment, I think you have some experience with Netbeans and if it works for you, then by all means use it. It is a fine IDE as well. Just remember, under Win32 you have only option of using GCC (MingW/Cygwin) as other compilers are, as yet, not properly supported. C::B supports many other compilers like MSVC.

    Bottom line, whatever works for you. C::B/NetBeans are both good IDEs for cross-platform development.

  • Adriaan

    So, some time has passed. I changed jobs etc. etc.
    These days I am working a lot with Qt and I was wondering if anybody has some recommendations for IDE when using QT.
    I have been using QtCreator and the latest version supports Visual Studio compiles – so that is a big plus. The IDE feels a bit basic to me though… was wondering what others are thinking.

  • susheel

    @Adriaan
    If you are using Qt then there is no point in using any other IDE. Qt creator is pretty good and it supports a good GUI editor for the toolkit.

  • Astha

    How can I set up my netbeans 7.0.1 IDE for c/c++ development.

  • susheel

    @Astha
    The easiest way is to download and install the Netbeans C++ package http://netbeans.org/features/cpp/

    If you already have netbeans installed and don’t have C++ plugin, you have to install it from the menu Tools > Plugins. Select the C/C++ plugin and click next.

    If you don’t have C++ installed then you need to either install Cygwin or MinGW under Windows or GCC under *NIX systems.

    Check the instructions on the page http://netbeans.org/community/releases/72/cpp-setup-instructions.html

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!