問題描述
我正在使用 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模板網!