How to automatically generate comments in Visual Studio 2017 and C++? - c++

I'm wondering if there is a functionality in Visual Studio 2017 to automatically generate documentation comments for parameters, return value, etc. in C++.
In Eclipse, Java, I start typing /** above a method and the rest is generated.
As someone answered here this functionality exists for C#, but I can't find any hints for C++.

That's one of the things where C++ tooling really falls behind. For VS you will need to use some third party extension, such as CppTripleSlash or CppDoxyComplete. Both are kinda crappy though (no template support, no exception spec support, no attributes support, no SAL support, etc.).

Related

Most compatible C++ Doxygen comments for IDE's

I've been working on some C++ code that some of the other developers I work with will use. A lot of the developers here are MS based (they use Visual Studio as their main IDE) we also have a lot of developers who use other IDE's as well for different projects (like Eclipse and Qt, even some C++ Mac development with XCode).
The code I have are generic library functions that are cross platform compatible, so it will be used by different developers on different platforms/IDE's. Which brings me to my question: is there a compatible Doxygen comment 'style' that can be 'understood' and used with the code completion ability by most popular IDE's (VS, Eclipse, Qt, Netbeans, XCode)?
Something like VS's IntelliSence where when you use your scope resultion a description pops up for that item.
If there is not a 'compatible' way, are there any plugins that can be used for all IDE's that would allow for this ability, or would I have to write my own? Googling has lead me to many dead ends (possibly because I may not be inputing my question into correct search terms), and writing my own plugins is an option, though I'd prefer a 'compatible' style or existing plugin if possible to save time.
Thanks in advance!
Edit 1: I should mention that I am requesting Doxygen style commenting becuase it is the documenting tool we use to build out some of our documentation thus all comments in any code we make must be Doxygen style (not sure why this issue never came up before here, haha)
So I have been struggling with this question for awhile now. In the past I have used several different software suites for development, with each having its own quirks in regards to using the documentation to drive some of the more fancy features. After working on a project in C# (and Visual Studio 2010) I have come to realize that the XML commenting seems to work the best for me.
I personally believe that this is a failure in most of the IDE applications themselves, for example, it seems that Visual Studio really only supports XML commenting for C# applications to feed features such as Intellisense, and the less fancy syntax highlighting. I have found that there is a commercial plugin available to "enable" this feature in Visual Studio, but why should I pay for something that just has not been enabled?
But I have diverged from your original question. When I was first researching this it seemed that Apple themselves must use Doxygen as they seem to use this standard for highlighting code already. With that said, here are some other resources to get the same functionality in other applications:
Atomineer Pro Documentation seems to be the tool for the job in regards to Visual Studio although I have not personally used it. It seems relatively simple to use.
Eclox seems to be a front-end plugin for Eclipse that actually uses Doxygen. But from what I remember you should be able to tweak the IDE itself in the C++ settings in regards to syntax highlighting.
Doxymacs maintains a symbol table inside of Emacs for some quick searching abilities.
It seems that on the Vim project page there's a script that handles this for that editor as well, it is called DoxygenToolkit.
I absolutely feel your pain. There's something warm and toasty about having a nightly crontab generate cleanly documented markup that is easily searchable. I have only recently been on a warpath for finding the best mechanism available for achieving this cross-platform. From what I've gathered most development environments support extensions of sorts, and since Doxygen is basically the "gold standard" there's usually one way or another to shoehorn support in if it doesn't exist out of the box.
If you're interested Doxygen actually supports the C# XML comments out of the box, but unfortunately I wasn't able to get it working in Xcode, and I'm not well versed enough in AppleScript to hack it together. But by all means please update if you do!

visual c++ and C++ builder

Can C++builder compile any c++ source files.
I don't have a good knowledge in c++. but i have some experience in delphi.
I like to use c++ but confused which one to use
I know that cbuilder has vcl , easy to develop ,easy for delphi developer
But my problem is can it compile any c++ files (vc++ and other source files).
is it compatible with vc++ (excluding MFC and VCL). Can i use any APIs with c++builder
You'll find C++ Builder very comfy coming from Delphi if you don't care about MFC or .NET via C++/CLI etc and just want native C++ then either will work for you. Visual Studio 2010 supports a lot of the new C++0x features which is pretty nice, although they don't have variadic templates yet. I'm not sure how much of C++0x is in C++ Builder as yet but that could be worth looking into as a deciding factor.
It should be able to compile any standards conforming code. If the code uses extensions that another compiler provides, it will more than likely have problems. VC++ has quite a few extensions that are on by default and so someone using that compiler might use them with out realizing what is going on(the same applies to G++ the other major C++ compiler out there.)
In my experience, C++Builder's support for more advanced C++ code is limited. For example, many of Boost's libraries are unsupported in C++Builder, and I've often had to modify other open source libraries to get them to build properly in C++Builder (due to various bugs or limitations in C++Builder's compiler). Simpler C++ code can work without any problems.
So, depending on what C++ libraries / source files / APIs you're wanting to use, getting them to work in C++Builder may be very straightforward, or it may take significant work.
You can download a free version of C++ Builder at www.embarcadero.com. With that, you can test your libraries for compatibility.

Can I use Visual Studio's testing facilities in native code?

Is it possible to use Visual Studio's testing system with native code? I have no objection to recompiling the code itself under C++/CLI if it's possible the code can be recompiled without changes -- but the production code shipped has to be native code.
The Premium Edition comes with code coverage support which I might be able to get cheaply from my University -- but I can get the Professional Edition for free from DreamSpark -- and that's the only thing I can see that I'd use. (But I'd use it a LOT)
Well, I hate to answer my own question, but the answer is no:
This is not going to fly, you cannot use any unmanaged code when compiling safe. That prevents use of any of the unmanaged CRT headers.
Unit testing requires /clr:safe. In other words, no, this is not supported. sigh

Which C++ does Visual Studio 2008 (or later) use?

I find C++ is very controversial language in microsoft world. By default we have ISO C++ and then microsoft has Managed C++ and now C++ CLI.
I just know standard (ISO) C++. I don't know microsoft's version of C++.
I'm confused about interpretation of any c++ code by visual studio 2008 (or later). Thats why I'm using gnu tools for compiling my programs. But I do love Visual Studio.
What settings do I need to make if I only want to use
STRICTLY ISO C++
Managed C++ (its deprecated but I think they still support it for sake of backward compatibility)
C++ CLI (for .NET platform)
I want to build native assemblies using C++ not managed ones. So, is there anything else should I need to do?
Everything is in the build settings:
Common Language Runtime Support (/clr) - add or remove CLR support
Advance Compile as C++ Code (/TP) - to choose if c++ or c..
Language: Disable Language Extention - use this to force ANSI.
When you ask Visual Studio to make a C++ project, it makes a C++ project. C++/CLI is a different language.
VS2008 and earlier have implemented C++03 (or approximated it. Like almost every other compiler, there are bits of the standard that are not followed to the letter. A few features are not implemented (exception specifications, the export keyword or two-phase name lookup are the ones I can think of), and some proprietary extensions are added as well.
GCC, and most big compilers, do the exact same thing, so this isn't a case of Microsoft being "evil" as such. The extensions can be disabled, leaving you with a reasonably standards-compliant compiler.
VC2010 is adding a number of C++0x features (and at least in the beta, I haven't been able to find an option to disable these), so from a strict C++03 compliance point of view, it is going to be less compliant.
Dani's answer already tells you which settings to change to enable/disable different language dialects.

Best C++ IDE or Editor for Windows

Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
What is the best C++ IDE or editor for using on Windows? I use Notepad++, but am missing IntelliSense from Visual Studio.
Um, that's because Visual Studio is the best IDE. Come back to the darkside.
I've found the latest release of NetBeans, which includes C/C++ support, to be excellent.
http://www.netbeans.org/features/cpp/index.html
I personally like Visual Studio combined with a third party add-in such as Visual Assist (http://www.wholetomato.com/). I've tried a few of the others and always ended up back with Visual Studio. Plus, Visual Studio is a widely used product in development industries, so having experience using it can only be a plus.
The Eclipse CDT works well for me. It supports MinGW and Cygwin as targets. It also integrates well with CVS and Subversion.
The latest build, Ganymede, is available here.
There are the free "Express" versions of Visual Studio. Given that you like Visual Studio and that the "Express" editions are free, there is no reason to use any other editor.
I vote for Visual Studio, but it seems that C++ is treated like second class citizen (not the compiler and stuff but IDE support) compared to .NET languages like C#, but hopefully MS will do something about it by the next version of Visual Studio (new standard is coming and they promised that 10 should be new 6).
VIsual studio is by far the best IDE but you can also take a look at Code::Blocks
I prefer to use Microsoft Visual C++ express on windows. Though the 2008 ide is fine, the 2005 express has better support for many of the open projects which you might want to participate in. It's a pain to compile Firefox or a half life 2 mod on 2008. Also as a general tip when looking for software, I like to search wikipedia for "comparison of " In this case you would search comparison of Integrated Development Environments.
Hope that was helpful.
If you are interested in doing Qt development, then Qt Creator works fine and is free.
I think the debugger in Visual Studio (Express) is the killer thing that prevents me from using another IDE.
Visual Studio + Visual Assist X (http://www.wholetomato.com/)
There are some features in an IDE that are so transformative that you don't know how you lived without them. Integrated help was one. IntelliSense-like functionality was another. VS 6.0's Debug and Continue was absolutely killer. Visual Studio kicked butt for quite a while. Not bad, given the awful NeXTstep rip-off it all started as. (Or is it that memories of NeXTstep has faded until VS seems okay?)
Sure, there are much better EDITORS that VS, but as a complete package for Win32 development nothing seems to come close.
There are free Express editions now, but they seem pretty crippled.
I am quite enjoying Eclipse under Linux (and derivatives of it on Windows used in some FPGA vendor toolchains). I -really- don't like the lack of integrated MSDN-style help, though.
I think it's basically down to those two choices.
Emacs. Xemacs works fine under Windows. For using it as an IDE, I recommend running it under Cygwin.
The Zeus editor has support for C/C++ and it also has a form of intellisensing.
It does its intellisensing using the tags information produced by ctags:
alt text http://www.zeusedit.com/images/_lookmain.jpg
Visual studio is the most up to date and probably "best" free ide. Dev C++ is a little dated, and mingw doesn't compile most of boost, (except regex). Most of the other compilers are dated and fading, like mars and borland. But you can use whatever you like!
One that hasn't been mentioned is CodeLite, a powerful open-source, cross platform IDE. It has code completion amongst other features.
I will quote myself from this question:
https://stackoverflow.com/questions/780837/what-is-a-good-linux-ide-for-code-completion/917854#917854
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.
My response is for Qt4 development only. Be warned.
SlickEdit is very cool, and does support something like intellisense. At my current company I now use Visual Studio, and I've mostly gotten used to it - but there are still some SlickEdit features I miss.
As a complete all-in one package, Visual Studio 2008 is the best IDE for C++ development with Windows
Visual studio is great, but there are few tricks you can enhance it with. SonicFileFinder is one - helps you to search source files by partial match. You can map solution-tree to Alt+1, partial filename search to alt+2, and properties-window to alt+3. These are the three most used windows.
Another great tool that is ofter misunderstood is ctrl+shift+F shortcut for searching file contents. People dont use because it's so slow, but my advice is - deal with it. Searching the whole solution (or even all files in project folder) is only slow the first time you use it. Consequitive searches are as fast as jump-to-definition-feature.
I've tried SlickEdit, Notepad++, emacs, jEdit and Visual Studio. VS wins hands-down for Best Windows IDE.
jEdit is probably the best GUI cross-platform editor/almost-IDE, and emacs is probably the best terminal cross-platform editor/almost-IDE. The advantage with using these is that when you jump to a Mac or Linux box, you know how they work.
I tried Eclipse, but it ran like a no-legged dog it was so slow, so I didn't use it much. Maybe tech is better now, but eh.
With Intellisense, code folding, edit and continue, and a whole host of other features, Visual Studio is certainly the best IDE. However, for simple code editing, I often use UltraEdit. It has some great features not found in Visual Studio. One surprisingly useful feature is being able to select a column in the editor. You can find and replace within the column (useful for tabs vs. spaces wars...) delete the column, etc...
How about CodeBlocks, i find it so fine with me, especially the new 10.05 version.
I would recommend C++Builder, from Embarcadero, for C++ work and there is also a free version available. If you prefer Visual Studio, download one of free express editions.
Here's another vote for Visual Studio. The debugger and Intellisense are definitely it's hallmarks. While other IDE's offer code-completion, I've often found them to be somewhat sluggish in this area for some reason (sluggish being a reference to the speed at which code-completion occurs and offers selections).
Other than VS, NetBeans is a good polished IDE and is updated on a very regular cycle.
I think it's largely a matter of taste, but I would recommend begginers to stick to a pure editor (vi, emacs...) instead of a full fledged IDE so they can figure out the whole toolchain that modern IDEs hide.
Just for the record, my weapon of choice is Emacs.
personally i dont like microsoft......I hate to admit that visual studio is the best IDE i ever use.....Netbeans is gud but drasticaly slow....other free IDEs are useless..
so people try to stick with VS....
M$ VS2008 is a better IDE for this.
The question says specifically IDE so I am guessing thats what you want. In that case, the main options are Visual Studio and Eclipse CDT as stated above. Of those, I personally prefer Eclipse. However, don't necessarily limit yourself to an IDE. I prefer to use vim as my editor and WinDbg as my debugger. For compilation, your project will probably dictate this. I currently use NMAke on the command line.
Use Visual Studio 2010. You can get the full version free with DreamSpark