views:

2861

answers:

22

So far for C++ Linux development, I've used Eclipse CDT and Code::Blocks. Compared to Visual Studio on Windows, their code completion features aren't too great. Could someone please suggest an IDE that has better C++ code completion than what I have tried so far?

A thread on the Ubuntu Forums suggests that Code::Blocks is actually superior to Eclipse in terms of code completion (but the thread is 2 years old now; Eclipse has come quite far in terms of speed since then), and also Anjuta is a good (I tried to use it once but it was too unfamiliar for me)...

On a Linux newsgroup message, a user suggests that Kdevelop and Anjuta are no good for code completion, but mind you this is 3 years old now. Someone suggests going with Emacs + Slime but I'm not sure I want to move away from my familiar graphical IDE.

I use Gnome if that's important.

Important:

This question is asking about code completion. Please do not answer with your favorite IDE just because its your favorite... To justify your answer you need to have used both Eclipse CDT and Visual Studio, otherwise you have no basis for comparison, and therefore you're not really answering my question. Please also say why it's better than Eclipse and how it differs from Visual Studio's code completion.

Bounty:

Today is 21 May 09, I've just added a bounty as I'm still not convinced I've got the answer I'm looking for. I actually stumbled upon this when googling for linux code completion. Some are pretty close, Qt Creator seems good but it just felt really foreign to me, and there's something about KDevelop that doesn't quite gel with me. Geany seems to only support code completion for the local class, which isn't very useful (I could be wrong here)... I just need something that is: An IDE or plugin (e.g. for vi/emacs) that is as good at C++ code completion, as Visual Studio is for C# code completion.

+11  A: 

KDevelop. http://www.kdevelop.org/

Jaap Geurts
Code completion for kdevelop4 is pretty good, which can work per file without even creating a project (ie, it reads the information from include files). Even Visual Studio 2010 can't do that. My question is then, is there any other IDE for Windows that can do that (code completion without creating project)?
leiiv
+13  A: 

If you plan on working with Qt then QtCreator is by far the preferred choice.

In fact QtCreator seems to be doing a decent job in code completion with non-Qt code too, I was rather impressed by it compared to previous versions. The only down side atm is that it's pretty tightly-coupled with Qt's qmake build system, but in the next version I believe they added support for CMake.

Idan K
+6  A: 

Unfortunately, intelligent code completion for C++ especially is one area where Visual Studio is still unrivalled. Many other IDEs are catching up, but they're not quite there yet.

palm3D
actually Visual Studio's own code completion for C++ is extremely flawed. the only thing that makes it anywhere close to good is Visual Assist X.
Idan K
@daniel, agreed. I think VS gets the reputation of having infallible code completion because of C#, where it is very well done. C++ code completion is just too hard. Try VS-C++ with some boost libraries and you'll see what I mean.
caspin
+12  A: 

You might want to try the NetBeans IDE C/C++ Pack.

Amit
I can attest that the code completion (C++) is decent in NetBeans.
postfuturist
Thank You. That is encouraging
Amit
+3  A: 

http://www.slickedit.com/ is nice one, but not free.

bb
Great IDE.I used the trail on windows.Amazing stuff and the new version is even better.+1 from me :)
the_drow
+4  A: 

I'm in love with Geany.

It might not be a full-fledged IDE, but it feels very lightweight, has support for highlighting, code-completion, gcc/g++ integration, symbol lists, great plugin support, etc.

(clickable)

Daniel
Geany is by far my favorite IDE for Linux.
Zifre
It seems to me that the error messages look a lot nicer than those from Eclipse CDT; they're very nicely parsed! On a scale of 1 to 10 how much better is the code completion in comparison to Eclipse CDT?
nbolton
@r3n: I've only once tried to use Eclipse CDT and it froze about 15 seconds before showing the code completion dropdown list, despite tweaking with all kinds of settings and googling my ass off. So yeah, I can't really make that kind of comparison but I am happy with Geany's code completion :)
Daniel
Daniel: I agree, Eclipse CDT is awfull for performance, hence why I have abandoned it in favour of emacs. When I tried Geany I could only get it to code-complete within the current file; were you able to get Geany to look inside your includes?
nbolton
A: 

There is also www.codelite.org

A: 

Try using KDevelop 4.0 beta. Although beta its code completion support is very good and has similar functionality as Visual Studio using Visual Assist. I'm using it in a productive environment.

+5  A: 

If your RAM size is greater than 1G and you have a relatively small project that does not use complex templates, Eclipse CDT 5.0 (not 4.0) is a great choice. Actually, I am looking for an IDE with good code completion for C++ too. So far Eclispe is my favorite - although it is very slow.

cnheying
It's true, the newer versions of CDT have a much improved indexer and therefore code completion. If the OPs experience was with an older version of the CDT I'll suggest he revisits CDT.
lothar
I tried CDT very recently, and found it to be better, but still quite buggy. Hopefully they'll make it more stable and less bloaty in years to come.
nbolton
+1  A: 

Anjuta is also a good IDE but I haven't used it for several years now. But earlier it supported code completion I think now they improved the feature more, better try it yourself, right now I am using Qt Creator and I am impressed with their implementation of code completion.

Anjuta

Anjuta Features

milot
+6  A: 

Code::Blocks is getting new code completion code. It's not integrated into the nightly builds yet but it seems that much work is going on there and that some results will be available soon (some months). I don't know how good it will be, but if you like CB be sure to check back later.

ziggystar
Does Code::Blocks look inside your includes for completions? I found that it only works for the current file, but I could be wrong.
nbolton
Judging on the forum posts, it will do that with the new code completion feature. Btw, of course everyone willing to build CB himself can try the feature.
ziggystar
A: 

There is also GPS, the GNAT Programming Studio, and yes, it does C++ and code completition. However, I can't remember how good it was, or why I dumped it. I am stuck to Code::Blocks now, and still miss the power of VisualAssistant. Nothing like it. Except Eclipse for Java, of course.

lImbus
+1  A: 

Try vim with cppcomplete.

Nikolai N Fetissov
Thanks, I'll try that if I end up abandoning emacs.
nbolton
+3  A: 

For a plugin for emacs see this post

auto completion in emacs

More precisely cedet, but any auto complete plugin based on tags will do the job.

Ben
Tried that, and it works quite well. The only catch is that you have to either use an EDE project, or open the file to which you require completions, ahead of wanting the completions, which is a little counter productive. This is just my personal experience though, I may have it set up wrong! :)
nbolton
A: 

If you want something better than Eclipse CDT or Code::Blocks, you'll have to be more specific about what you don't like in either of them than "their code completion features aren't too great". If you would list the specifics, you might get more useful info. Here's a start:

  • Eclipse CDT
    • Cons
      • Only semiautomatic discovery of builtin include paths
    • Pros
      • Autocompletion on #include (based on existing files and previously included files)
      • Configurable menus to cycle through to avoid having all completions displayed at once
  • Visual Studio
    • Cons
      • Difficult to debug when intellisense stops working

What is good code completion for you?

JesperE
+1  A: 

See this answer of mine.

nbolton
+5  A: 

I'm going to take the SO equivalent of bidding $1 on The Price is Right. :-)

An IDE or plugin (e.g. for vi/emacs) that is as good at C++ code completion, as Visual Studio is for C# code completion.

I doubt you will find it. Even Visual Studio isn't as good for C++ as Visual Studio is for C#. C# was largely engineered from the ground up to be easy to make development tools for. C++ is a notoriously difficult language to parse, and thus is also difficult to provide features like code completion for.

That's not to say that you won't find a "best" IDE for code completion. But I think that comparing it to Visual Studio for C# is an impossible task.

Jason Baker
+4  A: 

Based on the requirements you are looking for an answer that does not exist. You wish to have an IDE that has better auto-complete than VS then list every IDE found in Linux saying it isn't good enough. Adding a bounty will not cause these editors to become better.

The only comfort I can provide is it might come eventually. C++ is difficult to parse to be able to provide such quick reflections on live code. If Clang replaces gcc in Eclipse you might see the kind of auto-completion that you are looking for.

he_the_great
Thanks for the advice.
nbolton
+1  A: 

NetBeans IDE 6.7 Beta has pretty good support for code-completion and it is pretty stable. But I still use emacs with yasnippet and autocomplete.el, it's not as good as NetBeans but good enough for my requirements.

Cydork
Thanks, I use autocomplete.el - do I need an EDE project set up for autocomplete to look for c++ members?
nbolton
You need to enable EDE and add ac-source-semantic to ac-sources (for which you need auto-complete-semantic.el).
Cydork
+1  A: 

If Ruby is your language then JetBrain's RubyMine is amazing. It does code completion on javascript and ruby on things that can't be known until runtime.

Martin Murphy
+4  A: 

Someone already said this before me, but QtCreator is really good for Qt4 development.

Not only it has a really good code completion support. It also knows a little more about the code and what to complete then I thought I needed. For example it knows about slots/signals. This means that connecting slots/signals via code is much easier then before.

The code editing is really nice. I remember that when refactoring code, (a few variables starting with underscore) it remembered the cursor position between lines and this made the refactoring much easier. The code indentation is smart enough to not get in my way (KDevelop was configurable, but QtCreator learns how I code. At least it feels like it does).

Then there are the cool key combinations. Most of the functionality of the IDE can be accessed using shortcuts. The "control+k" thingie is a nice thing, which some command line users would like, but I am more GUI oriented. I don't use it.

What I really like, is the split window command. Yes, KDevelop3 does it, but not as nice as QtCreator. My favorite is control+e,3 which I use to display the header and implementations of my classes. Once again, the navigation here is the best I have seen (control+e,o).

It also has a nice SCM integration. I usually use SVN, and quite frankly it's not as good as I need: no shortcut to diff the project, no diff to commit the whole project, no option to commit several files.

I also don't like the "total integration of external tools". I still like the external QtAssistant - control+tab is easier to read large articles. But.... when you define a QString s, and 3 lines bellow you want to read the interface of QString, you put your cursor on "s" and press F1 - the assistant comes as a sidebar with QString's documentation. A huge advantage.

Want to follow a definition? F2 to the help. F4? Changes header/implementation (yes, eclipse does this better...).

The debugger is good. It's not as good as VisualStudio but ... it has support for Qt4 internals (you can see the value of QString and QList!).

I can continue... but IMHO you will need to give it a second and third try. It really is a good product. Not as flexible as Eclipse (hi ryansstack), but it's a really small, fast and young project. I stopped developing QDevelop because I really found what I was looking for.

ps: yes, I mean stopped developing QDevelop. I was in the development team.

elcuco
Ecellent answer. Thanks for spending so much time. This has opened my eyes a little. I may well consider QTCreator if Emacs doesn't work out for me.
nbolton
A: 

Why nobody mentioned MonoDevelop? I think it's the most similar IDE to Visual Studio on Linux.

Edit: I found after turning on "Parsing-based Proposals" in Eclipse(Helios) CDT's preference is really perfect.

fwoncn