How to write C++ comments that show up in Intellisense?

Etienne Dechamps picture Etienne Dechamps · Dec 23, 2011 · Viewed 54.7k times · Source

I'm programming in C++ using Visual Studio 2010 Ultimate. I want to document some functions and I want the documentation to show up in Intellisense.

According to MSDN, I just need to put the comment before the declaration or after it on the same line. So I tried this:

// This is a test.
void foo();
void bar() { foo(); }

When moving my mouse over foo(), the comment doesn't appear in the tooltip. I also tried:

  • ///
  • <summary></summary> tags
  • Building with /doc (by setting the "Generate XML documentation files" option in the project settings)

I've had no luck so far. Does anyone know a way to make this work?

Answer

Marcus10110 picture Marcus10110 · May 15, 2013

This now supported in VS 2012!

Previously, XML tags in the comments were only read in by C++/CLI, not plain old C++. VS 2012 now brings at least some of this into regular C++ - it is in the What's New in Visual Studio 2012 and in the MSDN docs: XML Documentation (Visual C++).

I've tested it with my own application in 2012 ultimate, and I can confirm that the summary, para, and seealso tags are all pulled out an formatted for tooltips.