Wednesday, December 26, 2012

What's wrong with Eclipse-CDT

In the world of C++ development most developers prefer an IDE which includes all the tools they need to accomplish their jobs. There is little doubt that on windows based platforms Microsofts visual studio is one of the better choices. I don't work a lot with windows, so I do not have that option. Throughout my career I've worked with tools like code::blocks, codelite, qt-creator, netbeans, vim and eclipse-cdt (and visual studio)

Now there is little doubt that eclipse is a very good tool, for java-developers, but as I've work for the past year with eclipse-cdt for c++ development, it has become painfully clear that this tool is in no way suited to use for c++ at the moment.

To describe the problem with eclipse-cdt we first need to look at the features promised by it's developers.

  1. Syntax highlighting
  2. Code completion
  3. Static analyzer
  4. Debugger
  5. Automatic make-file generation
  6. Refactoring
Now let's go through this point for point.

Syntax highlighting

This feature, for the most part works as expected, although in very long source-files it's quite slow. Now this is true for most editors, and should be a reminder to keep your source files within reasonable length. Of course for auto generated code  you often do not have a choice, but you should not be poking too much around in such files anyway.

Code completion

Now this is one of the places where eclipse-cdt truly fails. Especially for C++11. Now let's say you have a class that implements a pimpl idiom. So you forward declare your pimpl in your header file, then you use a std::unique_ptr as a member variable for said pimple, and you implement the pimple in the source file. At no point in your class implementation you will get any code completion on the pimpl member variable in eclipse. Actually I do not think I've had any success in getting any code completion from any of the std smart pointers. (Yes I have set up eclipse with all the settings for c++11).

Static analyzer

This is where eclipse-cdt fails the most. At the default settings the static analyzer named codan will mark most of your code as erroneous unless you write the simplest of code. This is understandable, as c++ is a hard language to parse, but come on, if you do release software that has a given feature, at least you would expect it to work most of the time. Codan is more or less completely unusable and in my projects I've ended up disabling it for almost everything except the "remind me if i forget a virtual destructor" (yes I have a habit of forgetting...).


The debugger feature for c++ in eclipse-cdt is actually quite good, and there is not much more to say except that I would prefer the debugger configuration to be better.

Automatic make-file generator

This is another feature which actually works fine, but most developers will find that in the environment they work in, they will have to implement their own make file, so for the most part it's just convenient for your compiling on your workstation.


Well this feature may work or not, and quite often the latter. It is also very limited and it seems to be incorporated just because the Java-refactoring in eclipse is quite good, so the c++ guys also wanted this. But  again, it just almost works...

General about eclipse-cdt

Now don't get me wrong, I believe eclipse-cdt is promising, but it is far from being the toolkit it pretends to be. Another example of it's shortcomings is the fact that in many of the configuration options for C++ has to be set in numerous places to gain effect throughout the application.

So what is the problem? Well, I'm an experienced programmer having 15 years experience professionally and 10 more years as a hobby-programmer while growing up. I find eclipse-cdt hard to figure out since a lot of the features just doesn't quite work, it works sometimes, but fails in other scenarios without giving much of an error-message. Now this is fine for many applications, but an IDE should make a programmers life easier, not harder, and thus at the moment I believe eclipse-cdt is borderline unusable. 

So what should be done?

In my view I believe both code completion implementation and the static analyzer should be ditched and be replaced by a solution based on clangs excellent framework. I mean clang-complete plugin for VIM is waaaaay better than eclipses implementation. And it is truly sad, because eclipse-cdt has the potential of being such a brilliant IDE.

In the mean time I will stick to VIM, my VIM-plugins and my make-files.