如何编写在Intellisense中显示的C ++注释? [英] How to write C++ comments that show up in Intellisense?
问题描述
我使用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:
-
///
-
< summary>< / summary>
标签 - 使用
/ doc
(通过在项目设置中设置生成XML文档文件选项)
///
<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?
推荐答案
现在在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 as "XML Documentation (Visual C++)" under "".
我在2012年测试了自己的应用程序,我可以确认摘要,para和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 ++注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!