【问题标题】:How to get full intellisense tooltip comments working?如何获得完整的智能感知工具提示评论?
【发布时间】:2011-01-25 17:04:23
【问题描述】:

我有一些 C++/CLI 软件,它们都很好,并以 C#'ish 的方式记录,这意味着 DOxygen 能够将其提取到一些不错的 html 中。有什么方法可以让我在智能感知工具提示中以 .net 框架的方式显示相同的信息?

例如,假设这是我的头文件(MyApp.h):

    /*************** MyApp.h ***************/

    /// My namespace containing all my funky classes
    namespace MyNamespace
    {
            using namespace System;

            ref class WorldHunger;

            /// A truly elegent class which solves all the worlds problems
            public ref class MyClass
            {
            public:
                    /// Constructs a MyClass
                    MyClass()
                    {

                    }


                    /// <summary>Attempts to fix world hunger</summary>
                    /// <param name="problem">The problem to try and fix</param>
                    /// <returns>Whether or not the problem was solved</param>
                    bool FixWorldHunger( WorldHunger^ problem );
            };
    }

...这是相应的实现:

    /*************** MyApp.cpp ***************/

    #include "MyApp.h"

    using namespace MyNamespace;

    MyClass::MyClass()
    {

    }

    bool MyClass::FixWorldHunger( WorldHunger^ problem )
    {
            bool result = false;

            /// TODO: implement something clever

            return result;
    }

当我键入时,intellisense 对内置函数的作用如下: http://www.geekops.co.uk/photos/0000-00-02%20%28Forum%20images%29/BrokenIntellisense1.jpg

当我键入时,intellisense 对我自己的函数的作用如下: http://www.geekops.co.uk/photos/0000-00-02%20%28Forum%20images%29/BrokenIntellisense2.jpg

肯定有办法做到这一点?

【问题讨论】:

  • 由 SO 问题“记录 C++/CLI 库代码以供 c# 使用 - 最佳工具和实践?”回答:stackoverflow.com/questions/1040479/…
  • 完美 - 不知道为什么我在搜索时没有找到:-/

标签: documentation c++-cli intellisense doxygen


【解决方案1】:

总而言之,要实现这一点,您需要兼容形式的 cmets:

/// <summary>
/// Retrieves the widget at the specified index
/// </summary>
/// <param name="widgetIndex">Index of the widget to retrieve.</param>
/// <returns>The widget at the specified index</returns>
Widget* GetWidget(int widgetIndex);

然后您只需在 Visual Studio 中右键单击该项目并转到 properties &gt; configuration properties &gt; C/C++ &gt; Output Files 并将 Generate XML Documentation Files 更改为 Yes

当您重建项目并将其导入其他地方时,您应该会看到完整记录的工具提示。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-08-25
    • 1970-01-01
    • 1970-01-01
    • 2016-08-22
    • 1970-01-01
    • 1970-01-01
    • 2017-03-16
    • 1970-01-01
    相关资源
    最近更新 更多