How to write C++ comments that show up in Intellisense?(如何编写出现在 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构建a>(通过在项目设置中设置生成 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++ 注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何编写出现在 Intellisense 中的 C++ 注释?
基础教程推荐
- CString 到 char* 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
