tags:

views:

242

answers:

7

Is there an IDE supporting C++ with REALLY smart searching of references? By 'reference' I mean usage of a class (or its member), variable, function in the whole Project or Workspace.

There's lots of IDE providing it. Some of them seem just to search for the text with same name giving lots of stuff, others are smarter and check the context (like class boundaries, namespace) but aren't accurate enough.

The best I've tried so far was Visual SlickEdit, but still there's more to wish.

class C1
{
    int foo;
};
class C2
{
    int foo;
};

For example in this situation when searching for C1::foo references I DON'T want C2::foo to be shown too.

So, is there an IDE that would be so smart?

Edit2

10x everybody for the answers so far.

I tried Eclipse, reference searching seems relatively good, but it takes it 20 minutes to index medium size project and 4 times of 5 it runs out of memory and crashes. I tried increasing it and some other advice and it got a little better, but still quite slow and annoying with these crashes.

I tried KDevelop3, but the feature mentioned in this question is not very advanced - seems to be just very advanced grep based text searching.

Edit4

KDevelop4 - I tried to make it work, but latest beta it's quite unusable for custom makefile projects, I was unable to do anything with it.

Edit5
I was surprised, but QT Creator did really well in my tests. It doesn't seem to create some tag/index files, but somehow manages to show very precisely the usage of variable/functions/classes. Unfortunately it seems to not work very correctly with templates, when following definitions of functions.

None of the mentioned IDEs could compete Visual SlickEdit in working with references, virtual functions, etc. QT Creator was the closest though, so I will choose it as an answer to my question.

+3  A: 

I think that you could use Eclipse , mainly i think that it will be able to do what you want, or nearly enough. Also here's a brief description of it's search options.

Adrian Faciu
10x, I'm trying it. If I win OutOfMemory battle, it might do the job.
Dmitry Yudakov
+1  A: 

No and I don't think we will ever see implementations that are as good as those in C# or Java editors for two reasons:

1) the preprocessor:

#ifdef _DEBUG
#define FOO(x) C1(x).foo
#else
#define FOO(x) C2(x).foo
#endif

2) templates:

template<class C> void Method(C const& c) {
    printf("%d", c.foo);
}

In both cases it is hard to determine which class is actually referenced.

Sebastian
I think we will see it eventually. As tools like gccxml and concepts like continuous compilation become more mainstream it will become easier for editor authors to integrate "proper" context correct searches.Having said that I don't think any such editor / process does things "right" on linux yet.
Michael Anderson
I think I read on the Visual Studio Developer blog about their implementation and why it is so difficult. If I recall correctly, they already use the compiler to populate their index of symbols but this is not enough because the parsing has to be very fault tolerant. At most times during editing, your code is not well-formed C++. This holds for all languages though.
Sebastian
A: 

I have not used KDevelop myself, but I get the impression that it does some serious parsing of the source code and is able to access source code information though the editor . It has at least some advanced code assistant functionality.

hlovdal
All IDEs do this.
anon
Yes, I get that. Since I do not program in C++ and have not used KDevelop myself, I am afraid of overselling it. My impression of the tool by having read blog posts about etc over time is that it is very good and above average on this. But I don't know. Hence a "check it out" answer.
hlovdal
A: 

You have to try KDevelop 4, not the old one.

Anon
I managed to build it, I'll see what I can do with it.
Dmitry Yudakov
+2  A: 

I think Qt-Creator can help you. There few new features added in new preview 2.0.

Sharique
2.0 is alpha, I'm looking for something more stable, but 1.3.1 did surprisingly well! 10x
Dmitry Yudakov
I suggest you to discuss your requirement in official forum or post it in issue Q (at http://qt.gitorious.org/qt-creator) so it can be included in 2.0 final release.
Sharique
10q, I will try
Dmitry Yudakov
A: 

You can look at CodeBlocks [http://www.codeblocks.org/]. I just started using it, but not tested for your requirement. So I am not claiming 10X now. But you can give it a try. Its open source and good one.

Kangkan
Yes, I've tried it before, but it seems to do just text searching when looking for occurrences of some item, I'm looking for something with deeper code understanding. Except this it seems really nice.
Dmitry Yudakov
+1  A: 

Did you ever try Netbeans. Close competitor of Eclipse it has all its feature like web development, mobile application ide, plugins to almost allow anything to do. All this with lower CPU and memory footprint. And it does resolve the name correctly.

Xolve
I've tried it once and didn't like it, but now it seems better somehow. And it does show the usage correctly. 10q, I'll give it a try.
Dmitry Yudakov
I feel that people are usually repulsive of the Swing theme at the first look if Netbeans itself. If you change to your native theme then it would look better.
Xolve