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


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?

Best Solution

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.