C++ IDE for Linux with smart reference searching - c++

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.

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.

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

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.

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.

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.

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

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.

Related

Is there anything to spell check code that is displayed in the GUI?

I am a student programmer using Qt to build several GUI applications for my company and embarrassingly I have a tendency to misspell words from time to time. Obviously it's not really much of an issue for my code as the compiler would be the first to let me know but is there any way to automatically check the spelling of strings or data that is displayed?
I really would like to know if Qt offers anything; boy that would be nice. I didn't see anything in the documentation though. I don't often have this problem but when it does happen it's so embarrassing.
Ever since I installed VisualAssist, it highlights spelling, even in comments.
Not sure what it looks like or if it only works with VS... I am using it in plain c++.
http://blog.qt.nokia.com/2012/05/22/qt-4-8-2-and-visual-studio-add-in-1-1-11-released/
I hope this helps.

C++: sorting/alphabetizing methods

OK, I have been looking for weeks now. I have looked through Eclipse and Visual Studio, but all the plugins for this sort of thing is for Java or C# and not C++. ReSharper does not work, nor does NArrange. How in the world can I sort my methods in a .cpp file without having to go in and cut and paste by hand (there are hundreds of files and there is not enough time in the world to do that)?
I have tried writing the program myself, but I am not very skilled in scripting and have zero experience in Python. Creating the program in C++ I believe is possible but if there is a simpler way then I would like to know.
I didn't use it but take a look at Regionerate. It is a plugin for Visual Studio. I am sorry, I saw now that it is also only for C#. I thought that it worked with C++ too. Sorry.
I have looked for a long time and talked to many co-workers and am now convinced we should not do it. Too many headaches and one of the developers said he didn't want that because of the way he writes his code. Thank the lord he said something!
If anyone else is looking to do this and trying to find a solution, I would just like to let you know that it is not worth the trouble. If you HAVE to do something like this in C++ then you have got to do it by hand. Pray that you don't have to.
I realize you've concluded you don't want to do this, but just in case someone else does, you might be able to use Doxygen to do the "heavy lifting" and extract the functions from your source.
You can configure Doxygen to extract the code structure from undocumented source files.
You'd then have to extract starting line numbers of the functions from Doxygen's output, sort, and reassemble. It gets messy because you might need to introduce forward declarations.
Thankfully you decided against doing it.

As of 2011: Netbeans 7 or Eclipse Indigo for C++?

This is basically a duplicate of:
Netbeans or Eclipse for C++?
But, that question as 3+ years old, and a lot has changed since then.
I have a large code base with a custom (but Makefile based) build system. The areas I am specifically wondering about include:
Syntax highlighting
Code navigation.
Code hints.
"ReSharper style" code helpers.
Documentation integration.
Debugger UI and features.
Has anyone had the chance to evaluate both Netbeans and Eclipse?
EDIT: As a followup question, are any of the Netbeans users here concerned with its future given Oracle's recent bad history with "open" efforts? (Open Solaris, MySQL, Open Office)
Thank you
I cannot comment on eclipse, but on netbeans 7 I will say things that are very important for me and that work fine so far:
code completion, go to declarations
pkg-config automatic include management for parsing
stuff that sometimes works and sometimes don't
find usages, sometimes it might fail to find usages in other open projects
debugger sometimes gets confused with unittest-cpp macros and it will not go on the appropiate line
stuff that are not yet working and i care deeply:
C++0x syntax highlighting (auto, lambdas, enum class, variadic templates, none of them are recognized by the built-in parser)
stuff that is not quite working but i could not care less:
git integration. I enjoy using git from command-line so this is a non-issue
in all, the IDE is very usable. I hope to have a chance to try out latest cdt on Indigo Eclipse, but so far i haven't that much of a real reason to investigate
I cannot comment on Netbeans, but I can offer you information on Eclipse. I work with C++ on UNIX systems, and I have started to use Eclipse when exploring large code bases that I know little about. I don't use it to build, but it would be easy to integrate our build system with it as one only needs commands.
Eclipse has most of what you are looking for: (I'm speaking of Eclipse/CDT)
Not only can you completely customize your syntax highlighting, you can also have it format the code with templates. My company has a code standard for spacing, tabs and formatting of functions and conditional code, and with little effort I was able to modify an existing template to meet our code standards.
The navigation is not bad, if you highlight and hover over a variable, it shows you the definition in a small pop-up bubble. If you do the same for a type, it will you show you where the type is defined. For functions, it will show the first few lines of the implementation of the function, with an option to expand it and see the whole function. I find all of these nice for code discovery and navigation. You can also highlight a variable, and use a right-click menu option to jump to its declaration.
I suppose by code hints you are referring to something like intellisense? This is the main reason why I use Eclipse when looking over a large code base. Just hit the '.' or '->' and a second later you get your options.
The debugger UI is quite capable. You can launch gdb within the tool and it allows you to graphically move through your code just as you would in a tool like ddd or Visual C++. It offers standard features like viewing registers, memory, watching variables, etc.
That being said, I have found some weaknesses. The first is that it doesn't really strongly support revision control systems outside of CVS and SVN very easily (integrated into the GUI). I found a plug-in for the system we use at my company, but it spews XML and Unicode garbage. It was easier to just use the revision control on the command line. I suspect this is the plug-in's issue and not Eclipse. I wish there were better tool integration though.
The second complaint is that for each project I have to manually setup the include directories and library paths. Perhaps with an environment variable this could be circumvented? Or I may just do not know how to set things up correctly. Then again if it is not obvious to a developer how to do this, I consider that a weakness of the tool.
All in all I like working with Eclipse. It is not my main editing environment, but I appreciate it for working on large code bases.
I'm a huge fan of Netbeans. I am in a similar situation to yours, but creating the project was very easy. Just point Netbeans at where the code is checked out and it figures out most things for itself. I rarely have to do any configuration. One thing to note though, if your tree is very large, it can take some time to fully index - and while it does, memory and cpu will be hosed on the box.
The integration with cvs is awesome, and the Hudson integration is very cool for CB. I've not used Git myself, though I should imagine it's a no-brainer.
One thing that does irritate me no end is that it does not behave very well with code relying heavily on templates. i.e. shows lots of warnings and errors about types not being found etc.
I have not used the latest version of Eclipse, I tried the major release before the current one and gave up because it did not have the same smooth project integration with the makefiles etc. I find it's not as nice if you don't want to use it's make system - though I could be wrong.
I don't use any of the code formatting provided, I instead prefer something like AStyle instead. I know that NetBeans does a good job with Java - but have not used it for C++. CDT I seem to remember doing some odd stuff with indentation when formatting C++ code - esp. if templates are involved - but that was atleast two years ago.
Hope some of it helps - the best way to do this is to download and try for yourself and see what works for you. Anything we tell you is purely subjective.
I used to work with Netbeans with MinGW, I Just tried 7.0.1.
I currently use Eclipse Indigo with CDT and MinGW - It's better performance wise (less CPU & Memory).
Netbeans creates a makefile to compile all the time,
In Eclipse you can build directly with the CDT-Toolchain or use Makefile - Eclipse is more flexible.
Debugging: Netbeans might be better in Solaris/Linux.
I Personally rather eclipse over Netbeans, I think eclipse is more professional.
One particular issue that causes me quite a lot of grief with Netbeans 7.0 is that it tends to want to work with utf8 files, and not all of out c++ projects are utf8. It will issue a warning about opening such a file, and if you do open it, will corrupt said file, which is a pain.
I've not found out how to properly make netbeans handle this. Apparently the encoding can be changed, but for the entire project. So presumably changing it to us-acii would stop this problem, although non ascii characters wouldn't display properly.

How can completely port a qt3 library to qt4?

I have been stumbling through some different steps to do this. I ran the qt3to4.exe on the files with compile errors and got though a lot of conversion steps, however now I am getting this error:
1>c:\qt\4.7.0\src\qt3support\widgets\q3toolbar.h(64) : error C2039: 'ToolBarDock' : is not a
member of 'Qt'
and 55 other similar errors. This confuses me since it is in qt's own q3support library. I also saw on a QT help page (http://doc.trolltech.com/4.2/qt-qt3.html) that ToolBarDock is deprecated and Qt::Dock should be used instead.
I haven't found much help on this out there. I'm using the library inside Visual Studio 2008. Any QT/visual studio experts out there?
If this helps, here is the code it is failing on in q3toolbar.h:
Q3ToolBar(const QString &label,
Q3MainWindow *, Qt::ToolBarDock = Qt::DockTop,
bool newLine = false, const char* name=0);
Actually qt34qt4 doesn't do all things right. There are many methods, enums etc, which are not converted. It is more or less simple find-replace tool which replace following instructions from qt\tools\porting\q3porting.xml
In many cases there is a replacement definition for a class, but not for a method of this class. In some cases qt3to4 replaces enums and methods in code which doesn't belong to Qt-classes at all. So be carefull. In any case, I would suggest getting a list of all Qt classes in you code, read carefully porting notes (http://doc.qt.nokia.com/4.5/porting4.html) for each class you use.
Another issue are return types, qt3to4 doesn't check how the returned value is used. Fortunate qt3to4 makes a good job, so fixing the rest is often a trivial, repetitive task.
If you have to port UIs, take a look at undocumented argument -wrap of uic3.
P.S.: Some figures for your effort estimation, may be usefull: I've ported (got compiled) once 600TLOCs + 150 UIs in 2,5 Months, currently I am porting about 150 TLOCs project and got pretty far in 2 weeks.
I had these errors as well after importing a project into VC++. Adding QT3_SUPPORT to the preprocessor definitions fixed it.
I ended up going a different route on this problem. I found the implementations I needed from the "qt3 library" somewhere else. Just before I found that out, I got some advice from some coworkers here. The consensus was that I'd need to rebuild Qt specifying to include qt3 support. Although I didn't follow through with this, here are some helpful links.
http://www.qtcentre.org/wiki/index.php?title=Qt4_with_Visual_Studio
http://lists.trolltech.com/qt-interest/2006-11/thread00177-0.html
If anyone comes across this and gets through this problem, please post your solution! Thanks.

Autocompletion in Vim

In a nutshell, I'm searching for a working autocompletion feature for the Vim editor. I've argued before that Vim completely replaces an IDE under Linux and while that's certainly true, it lacks one important feature: autocompletion.
I know about Ctrl+N, Exuberant Ctags integration, Taglist, cppcomplete and OmniCppComplete. Alas, none of these fits my description of “working autocompletion:”
Ctrl+N works nicely (only) if you've forgotton how to spell class, or while. Oh well.
Ctags gives you the rudiments but has a lot of drawbacks.
Taglist is just a Ctags wrapper and as such, inherits most of its drawbacks (although it works well for listing declarations).
cppcomplete simply doesn't work as promised, and I can't figure out what I did wrong, or if it's “working” correctly and the limitations are by design.
OmniCppComplete seems to have the same problems as cppcomplete, i.e. auto-completion doesn't work properly. Additionally, the tags file once again needs to be updated manually.
I'm aware of the fact that not even modern, full-blown IDEs offer good C++ code completion. That's why I've accepted Vim's lack in this area until now. But I think a fundamental level of code completion isn't too much to ask, and is in fact required for productive usage. So I'm searching for something that can accomplish at least the following things.
Syntax awareness. cppcomplete promises (but doesn't deliver for me), correct, scope-aware auto-completion of the following:
variableName.abc
variableName->abc
typeName::abc
And really, anything else is completely useless.
Configurability. I need to specify (easily) where the source files are, and hence where the script gets its auto-completion information from. In fact, I've got a Makefile in my directory which specifies the required include paths. Eclipse can interpret the information found therein, why not a Vim script as well?
Up-to-dateness. As soon as I change something in my file, I want the auto-completion to reflect this. I do not want to manually trigger ctags (or something comparable). Also, changes should be incremental, i.e. when I've changed just one file it's completely unacceptable for ctags to re-parse the whole directory tree (which may be huge).
Did I forget anything? Feel free to update.
I'm comfortable with quite a lot of configuration and/or tinkering but I don't want to program a solution from scratch, and I'm not good at debugging Vim scripts.
A final note, I'd really like something similar for Java and C# but I guess that's too much to hope for: ctags only parses code files and both Java and C# have huge, precompiled frameworks that would need to be indexed. Unfortunately, developing .NET without an IDE is even more of a PITA than C++.
Try YouCompleteMe. It uses Clang through the libclang interface, offering semantic C/C++/Objective-C completion. It's much like clang_complete, but substantially faster and with fuzzy-matching.
In addition to the above, YCM also provides semantic completion for C#, Python, Go, TypeScript etc. It also provides non-semantic, identifier-based completion for languages for which it doesn't have semantic support.
There’s also clang_complete which uses the clang compiler to provide code completion for C++ projects. There’s another question with troubleshooting hints for this plugin.
The plugin seems to work fairly well as long as the project compiles, but is prohibitively slow for large projects (since it attempts a full compilation to generate the tags list).
as per requested, here is the comment I gave earlier:
have a look at this:
Vim integration to MonoDevelop
for .net stuff at least..
OmniCompletion
this link should help you if you want to use monodevelop on a MacOSX
Good luck and happy coding.
I've just found the project Eclim linked in another question. This looks quite promising, at least for Java integration.
I'm a bit late to the party but autocomplpop might be helpful.
is what you are looking for something like intellisense?
insevim seems to address the issue.
link to screenshots here
Did someone mention code_complete?
http://www.vim.org/scripts/script.php?script_id=1764
But you did not like ctags, so this is probably not what you are looking for...