如何让完整的智能感知工具提示评论正常工作?
我有一些 C++/CLI 软件,这些软件都很好,并且以 C# 式的方式进行记录,这意味着 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;
}
这是当我键入时智能感知对内置函数所做的操作: http://www.geekops .co.uk/photos/0000-00-02%20%28Forum%20images%29/BrokenIntellisense1.jpg
这是当我键入时智能感知对我自己的函数所做的操作: http://www.geekops .co.uk/photos/0000-00-02%20%28Forum%20images%29/BrokenIntellisense2.jpg
当然有办法做到这一点吗?
I've got some C++/CLI software which is all nice and documented in a C#'ish kind of way which means DOxygen is able to pull it out into some nice html. Is there any way I can get that same information to appear in the intellisense tool tips the way that the .net framework does?
For example, lets say this is my header file (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 );
};
}
...and this it's corresponding implementation:
/*************** MyApp.cpp ***************/
#include "MyApp.h"
using namespace MyNamespace;
MyClass::MyClass()
{
}
bool MyClass::FixWorldHunger( WorldHunger^ problem )
{
bool result = false;
/// TODO: implement something clever
return result;
}
Here's what intellisense does for built in functions when I'm typing:
http://www.geekops.co.uk/photos/0000-00-02%20%28Forum%20images%29/BrokenIntellisense1.jpg
Here's what intellisense does for my own functions when I type:
http://www.geekops.co.uk/photos/0000-00-02%20%28Forum%20images%29/BrokenIntellisense2.jpg
Surely there's a way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
总而言之,要使其工作,您需要以兼容的形式提供注释:
然后您只需在 Visual Studio 中右键单击该项目,然后转到“properties”>“properties”即可。配置属性> C/C++>输出文件并将
生成 XML 文档文件
更改为是
。当您重建项目并将其导入其他位置时,您应该会看到出现完整记录的工具提示。
Just to summarise, for this to work you need your comments in a compatible form:
Then you simply right-click on the project in Visual Studio and go to
properties > configuration properties > C/C++ > Output Files
and changeGenerate XML Documentation Files
toYes
.When you rebuild your project ad import it somewhere else, you should see fully documented tooltips appear.