我正在使用 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++ 注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
为什么两个函数的地址相同?Why do two functions have the same address?(为什么两个函数的地址相同?)
为什么 std::function 的初始化程序必须是可复制构Why the initializer of std::function has to be CopyConstructible?(为什么 std::function 的初始化程序必须是可复制构造的?)
混合模板与多态性mixing templates with polymorphism(混合模板与多态性)
我什么时候应该使用关键字“typename"?使用模When should I use the keyword quot;typenamequot; when using templates(我什么时候应该使用关键字“typename?使用模板时)
依赖名称解析命名空间 std/标准库Dependent name resolution amp; namespace std / Standard Library(依赖名称解析命名空间 std/标准库)
gcc 可以编译可变参数模板,而 clang 不能gcc can compile a variadic template while clang cannot(gcc 可以编译可变参数模板,而 clang 不能)