Attaching Documentation in Visual Studio (à la Eclipse) - c++

I'm new to Visual Studio (2012) and having come from using Eclipse, I'm finding myself missing the ability to hover my mouse over a method and receive a dialogue detailing the parameters and any accompanying comments.
In this particular example, I'm using the OpenGL SDK with C++ in Visual Studio, and I would like to be able to quickly get at the documentation without having to jump between VS and http://www.opengl.org/sdk/docs/man/.
Is there a way that I can attach the documentation somehow so that I can view it from within Visual Studio itself without needing to manually search?

visual studio does provide the functionality you are looking for as a tooltip (instead of a dialogue) when you hover long enough (2-3 seconds). For this to work correctly and more usefully though, you'd need the functions to be documented properly in the code itself.
Check the following questions for more information on how intellisense tooltip works :
How to get full intellisense tooltip comments working?
Documenting C++/CLI library code for use from c# - best tools and practices?
By default though, intellisense will simply display the comment above the function declaration or deninition (which ever comment is larger, it seems). It takes a while longer when you hover first time over a function, so be patient and retry :)

you can type in the code 3 slash /// and visual studio automaticalli write a xml template for the documentation of the method/class/property.
next you can go in the project properties. Build tab, Output section, XML documentation file, and enter the filename. It will be built on every build of the project.
You could try NDOC or SandCastle if you dont mind using 3rd party tools.

Related

XML Documentation Navigation for C++ in Visual Studio (as in C#)

There is XML Documentation support for Visual C++ with IntelliSense and all for some time now.
Navigation from XML documentation, peek help etc. does not work though. Coming from C#, I dearly miss those functionalities.
Is there a way to enable this in Visual Studio, maybe via a plugin?
To automatically create XML documentation templates, one can use CppXmlComments-Plugin.

Visual studio c++ project go to definition opens object browser instead of going to source code

I have seen the following questions and tried all of their answers:
Visual Studio Go to Definition (F12) opens Object Browser instead of Code View
How can I turn "Object Browser" to "Metadata" for "Go to definition" in Visual Studio 2010?
Namely that I have tried:
Cleaning the project and deleting all generated project files
Resetting all of the keyboard mappings
The difference in this question from the previous listed is the following:
It is a C++ project, not c#, there are no references and no .NET version.
I have not installed nor do I use the ReSharper program.
I have tried checking out the same code and solution in a separate directory, and the problem no longer occurs (but still occurs in the original after a clean checkout)
This started today, and I am unaware of an event that could have caused it. I have not installed any new plugins or similar. The only thing that has happened recently was that yesterday I installed some NUNIT references into a C# project that is in the same solution.
Since the other posts listed above did not list explicit details about the problem, this is a detailed description of what is occurring:
I try to go to definition on an object (or go to declaration), with either F12 or the right-click menu:
Instead of going to the source of this (ie the HeartBeat class) it will show in the symbol search a list of possibilities:
All of these references open the object browser window instead of going to the source:
How can I revert the behavior of visual studio to normal?
As the OP mentioned, /resetuserdata will definitely bring your Visual Studio back to normal as follows:
devenv.exe /resetuserdata
although this is not the fundamental solution.
This kind of weird situation can occur especially when you run multiple Visual Studio at the same time, and you changed a few configurations only on one of them.
That's because Visual Studio tries to share the same .vssettings and the file is over-written every time it exits, to keep .vssettings to have the newest configuration sets you made at all times - the definition of the newest configuration is the one the last Visual Studio that you closed has.
Therefore, the configuration change that you think you've made might not be the one your Visual Studio is running on.
To prevent this from happening, you could make your .vssettings Read-Only.
Then every time you close it, your VS will complain about it, but you can keep your customized configuration safe. (Which, I agree, is sort of ugly though)

peek help in Productivity Power-Tools plugin for Visual Studio 2013 opens same page every time

When I right click on a type, for example int and click peek help I am always shown the same page:
Writing Code in the Code and Text Editor
How can I fix this?
I found the Custom Web Search Visual Studio extension to be a decent replacement for this functionality. However, it only supports Visual Studio 2017.
I made a custom Google search because the search function on learn.microsoft.com is less than desirable: https://www.google.com/search?q=site%3Alearn.microsoft.com+{QUERY}, e.g. https://www.google.com/search?q=site%3Alearn.microsoft.com+CreateFile.

Visual Studio 2010/2012 Add-in Project Questions

I have already created a simple source code analyses tool for C/C++, but I wanted it to be an extension or tool for Visual Studio 2010 and 2012 editions. It is written completely in C++. For this reason I created it using "Create an Add-in using Visual C++/ATL" option. And then under "Choose Add-in Options", I have some problems. I don't know which one or ones to select. I want it to have a name and icon under Tools section, but on the other hand, my code analyzer can be used from command line too. If someone can advice me which option(s) to select there I would be glad.
My second question is this, when I have opened a source file in Visual Studio, and if I go to Tools -> MyAddin, and press it, I want it to do its job and analyze the code, and show the results in the output section below.
And my last question is that, if I have a C/C++ project with few files let's say, and if I right-click one of the files, I want to see my add-in and be able to execute the add-in from there, not to go always to Tools -> MyAddin. And also the same thing to work if I right-click the project, then it should analyze the all files and show the problems in the output section.
Please note that I have already created the source code analyzer tool in C++, and I have it as a DLL. I can also use it in Linux from terminal, and if I want I can also create a GUI for it, which I plan to do later. But I'm not that much experienced with Visual Studio, especially about add-ins, that's why I need your help. As you can see my first question is a kind of advice, but I think my second and third questions require some source code. I know that it is very hard for you to give me some help without seeing my code, but if you would help me somehow I would be glad.
For Visual Studio 2010 and 2012 you should consider using Extensions, not Add-Ins. It is a new technology introduced in Visual Studio 2010. Extensions come in form of a VSIX packages and are automatically installed in all applicable versions of Visual Studio. If you are not targeting Visual Studio version prior to 2010, I strongly recommend using extensions.
From this point of view, I will not answer any of your technical questions about Add-Ins. Here are a couple of links to start using extensions instead:
Anatomy of a VSIX Package
Building and publishing an extension for Visual Studio 2010
VSX FAQ
Walkthrough: Creating an Options Page
I think you will find valuable information on this topic here: Developing extension packages for Visual Studio 2005/2008/2010/2012 using C# with real-life samples

Cygwin in Visual Studio

I'm trying to port an old program I wrote for class from KDev in Ubuntu to Windows Visual Studio 2008 using Cygwin as a personal learning exercise. I have the include path configured to include C:\cygwin\usr\include but it doesn't read the .h files properly.
Namely I'm curious as to how one would go about using unix sockets.h functionality in a Visual Studio environment using Cygwin. Has anybody ever got this working or have an easier way to go about doing this?
There are several ways to go about this that could be made to work, depending upon your exact goals. The simplest way is probably just to create a Visual Studio "makefile" project that fires off a custom build command to run a makefile you've built. But that keeps you away from a lot of the nice benefits of Visual Studio as an IDE, so I'm guessing that's not really what you're after.
If you want a more fully integrated solution, you're going to need to do two things. First of all, you're going to need to change out all of your include/library paths to avoid the Microsoft ones and go after the Cygwin ones instead. You can do this by selecting "Tools->Options" from the menu, then choosing "Projects and Solutions->VC++ Directories" from the tree on the left hand side of the window that comes up. You'll have options to change the search directories for executables, headers, libraries, etc. For what you're trying to do, I'd suggest removing everything and adding in just the cygwin directories.
Second, you'll have to tell Visual Studio to use the gcc/g++ compiler. This is a bit trickier. VS supports custom build rules for custom file types... but it seems to have C++ hardwired in for the Microsoft compiler. I don't really know a great way around that except to use your own custom file extension. You can try the standard unix extensions of .c (C files) and .cc (C++ files), but I suspect Visual Studio will automatically pick up on those. You may have to go with something totally foreign.
If you right click on your project in the Solution Explorer and select "Custom Build Rules" you'll be given an interface that will let you create your custom build rules for the file extension you've chosen. The interface is relatively straightforward from there.
This might not get you exactly what you wanted, but it's probably about as close as you're going to get with Visual Studio.
Simply speaking, don't do that. It would be just waste of time. I tried it several times, but always failed. Mostly, I was frustrated by many linking errors, and also was unable to use VS as a debugger.
You can use Visual Studio for editing and browsing source code. It is nice because VS provides the best C/C++ intellisense features (e.g., Auto completion, fast go to definition/declaration). But, it is very hard to use cygwin tool chains with Visual Studio 2008. Visual Studio 2008 is not designed to work with other tool chains. Specifically, you need to change (1) headers, (2) libraries, (3) compiler and (4) linker. However, it is generally very hard, or you need to trade off with the nice features of Visual Studio.
The strongest feature of Visual Studio is its debugging ability such as fully integrated debugging environment and very easy watch windows (e.g., you can see STL vector's element directly in watch windows). However, you can't do this if you would change fundamental tool chain (although I am very suspicious it is even possible to safely build with Visual Studio and cygwin tool chains).
Unfortunately, current Visual Studio 2008 is not for cygwin/MinGW.
This is an old question, but since it comes up first (for SO) on a Google search I wanted to share that it looks like the latest Visual Studio versions do support this.
For instructions, refer to this blog post:
https://blogs.msdn.microsoft.com/vcblog/2017/07/19/using-mingw-and-cygwin-with-visual-cpp-and-open-folder/