Auto-Include needed C++ headers IDE? [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm a Java Eclipse user as well as a Qt Creator IDE user.
In Eclipse IDE for Java, when I type this line for example :
Vector<int> v = new Vector<int>();
it automatically generate this line at the top of the code :
import java.util.Vector;
Question :
Is there a C++ IDE or a plug-in for the Qt IDE that generates for example this line :
#include <vector>
after I type :
vector<int> v;

I'm using NetBeans IDE, which can handle C/C++, PHP, Java, ....
It has autocomplete for writing functions / included headers etc.
Allso it can sometimes automatically add appropriate headers, if I use autocomplete when writing a function name, but still, it's better to define needed header files manually. ;)

What you can do to automate this is going to vary by IDE. However, what you can do universally is Google search for say, std::vector and practically any result is going to include the name of the header you need.
Of course, in these days of precompiled headers, it's not unheard of to blanket #include a wide-range of common STL stuff even if your project doesn't currently use it.
On a related note: for your example, auto-addition is potentially ambiguous since you didn't specify the std namespace.

Most C++ IDEs don't provide this (though I believe VisualAssist for Visual Studio does). As people have said, C++ is not the nicest language to parse which makes this a little more challenging.
Typically C++ folks just know what headers they need to include :)

Related

Simple Intellisense Solution [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I'm working on a project in C++ with and the ROS Catkin compiler system (Ubuntu). Its my first real project with ROS and I would to keep the setup simple (as the code itself will be hard enough).
Preferably I would like to just use Sublime to edit the code, but it has no c++ intellisense (already found a linter and formater plugin). I also tried Eclipse, but there the intellisense seems to not work unless I set up a whole project.
Does anyone know a simple setup for c++ intellisense on Ubuntu (using Sublime/Eclipse or something else)?
I'd really love to have it as it allows to naturally explore new libraries without the need to open the documentation for. ever. new. class.
This is the plugin I use for atom text:
https://atom.io/packages/autocomplete-clang
I believe it exists for sublime as well:
https://packagecontrol.io/packages/ClangAutoComplete
Eclipse has a C++ IDE version, so use that if you want to use eclipse:
http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/keplersr2
And also, if you don't mind IDEs you should check out QTCreator and Kdevel, the first I've noticed to be one of the most used IDEs for people that don't just use vim or emacs. Kdevel I've used a bit and it has some interesting features, though some things might be lacking. In both cases there are some speed problems with autocompletion (wait times of 100-500ms) and code highlighting (sometimes it breaks a bit and highlights the wrong line or doesn't highlight at all, but that's very rare)
Another alternative that people might mention is CLion, which is from Jetbrains, but its closed-source, not well supported and whilst it might look nicer than QTcreator it has more or less the same features but is much more resource-heavy and laggy, so I'd pass on that.
Also, most of the "old guard" seem to swear by vim and/or emcas and if you have a lot of time on your hands you could check out a guide for setting up one of those as a C++ text editor, they both have very mature plugin systems and whilst they might be harder to get into they might also give you more freedom and more interesting plugins.

how can i find the structure of a downloaded c++ software source code [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I have got a c++ software from git.There is no documentation of the code.To understand the code, I need a way to figure out the classes & which functions call the other, preferably in the form of a tree.
I tried with doxygen, but i got only class description. I didnt get function hierarchy. Is it possible to get function hierarchy details using doxygen?
Eclipse (CDT - which is the C++ version) and Visual studio IDEs support building call hierarchies and caller hierarchies for any method you choose.
You can start from the main() and then dive in...
I suppose other IDEs such as CLion also support this.
I am presonally not familiar with a tool that will graph out all the code at once and in any case I think the output of such a full graph would be unreadable.
I suggest you choose an IDE and go from main() and build "call hierarchies" from the methods. Another good method would be to run it with debug and trace through it, then you can choose how deep you can go into the call hierarchies of the methods.
You can use a proper IDE like Microsoft Visual Studio. Here requested link for doxygen. You can clone it from git

Visual Studio 2015 automatically include missing includes [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I wanted to ask if anyone of you knows if there is a setting or plugin for Visual Studio 2015 Enterprise to automatically include any missing things, example if a namespace is missing or if "endl" is missing it includes the class.
Thanks!
I'm afraid not only can I not find / am not aware of such a plugin - I doubt it will ever exist.
The problem comes that without knowing every include file on your computer (which is a very time consuming/hard process), how could said plugin know which one you wanted?
Example:
I have marmalade (A cross platform development tool), Cygwin-Dev (A windows unix-shell), a GCC-cross compiler and visual-studio installed.
This means my computer has four (if not more) versions of "iostream", as well as several different implementations of the standard library (for different platforms).
How could such an add in know "which" include I wanted?
Personal opinion:
I understand what you are looking for, but honestly - even if such a tool did exist, I would advise against using it. when you get beyond simple example "hello world" programs and alike, C++ include files become a non-trivial subject. A single project I am involved in professionally has near two-thousand header-files, ranging from Iostream, though to third-party libraries, and near a thousand home-grown files.
Managing and understanding what to include and where is an essential skill of the C++ programmer, and quickly becomes second nature.
P.S.
Remember that every function on sites such as en.cppreference.com/w/ will state at the top of the page what header file you need to include them. Reading such reference pages will (also) become second nature in due time.

Cross platform way to create file dialog in C++ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I am writing an application in which I need to be able to browse for an existing file and to create a new one. I need to create user interface for that. Is there any good cross-platform free library to help me do that?
If you're not already using a cross-platform UI library, then it doesn't make a lot of sense to introduce a dependency upon a huge library just to display a file dialog.
Since recommendations for a cross-platform UI library have already been hashed out repeatedly in other questions (use the search feature to find them if you're interested) and are probably off-topic anyway,
I'm going to take the liberty of assuming that such is not your question.
Therefore, the answer is that no, there is no reliable, cross-platform way of creating a file dialog. Each platform provides a different interface/API for this, so you'll need to write code to detect the current platform and then display the dialog as instructed by each platform's documentation.
You can do this either at run-time (if you want to have a single binary), or at compile-time by using conditional compilation (#if statements).
This is basically all that any UI library would be doing, and for such a simple requirement (a single feature) it makes sense to me at least to just do that work yourself.
You can give wxWidgets a try, a GUI library in C++, free, open-source,... and work with the native graphics libraries.

any code conversion tool for converting borland c++ to visual studio C++ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I have a old windows application written in borland C++ 5.0. this uses the OWL library very much in it's code. this has to be ported to Visual studio 2005/2008 (C++ or C#). search in google shows lot of links but nothing quite concrete or useful. can anyone show the correct direction to start this? also share any pitfalls or best practices?
this is going to be a painful process to do. you may end up re-writing the entire application. before that consider OWLNext in sourceforge.
PS: I don't have any experience in doing this.
if you do not want to rewrite the entire application, your best bet is to migrate to OWLNext
(http://owlnext.sourceforge.net/).
First step will be to still use Borland C++ 5.0x, but upgrade the project to use OWLNext instead of the old OWL libraries.
After that, you can create a new VC++ project, add your sources there, build OWLNext for VC++ and start using it for further development.
Jogy