如何编写出现在 Intellisense 中的 C++ 注释?

How to write C++ comments that show up in Intellisense?(如何编写出现在 Intellisense 中的 C++ 注释?)
本文介绍了如何编写出现在 Intellisense 中的 C++ 注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在使用 Visual Studio 2010 Ultimate 进行 C++ 编程.我想记录一些函数,并且我希望文档显示在 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.

根据MSDN,我只需要将注释放在声明之前或之后在同一条线上.所以我尝试了这个:

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(); }

将鼠标移到 foo() 上时,工具提示中不显示注释.我也试过:

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

  • ///
  • 标签
  • 使用 /doc(通过在项目设置中设置生成 XML 文档文件"选项)

到目前为止我没有运气.有没有人知道如何使这项工作?

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

推荐答案

VS 2012 现在支持!

This now supported in VS 2012!

以前,注释中的 XML 标签只能由 C++/CLI 读取,而不是普通的旧 C++.VS 2012 现在至少将其中的一些带入常规 C++ - 它位于 Visual Studio 2012 的新增功能 和 MSDN 文档:XML 文档 (Visual C++).

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++).

我已经在 2012 Ultimate 中使用自己的应用程序对其进行了测试,我可以确认摘要、段落和 seealso 标签都被拉出格式用于工具提示.

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.

这篇关于如何编写出现在 Intellisense 中的 C++ 注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)
Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)
STL BigInt class implementation(STL BigInt 类实现)
Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)
Move list element to the end in STL(在 STL 中将列表元素移动到末尾)
Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)