问题描述
我正在充实模块的doxygen文档,并遇到了一个奇怪的问题。当引用位于命名空间中的变量时,自动链接不起作用。这是一个摘要:
I am fleshing out the doxygen documentation for my modules and came across a strange problem. When referencing variables located in a namespace autolinking does not work. Here is a snippet:
namespace isa {
const double H_max= 10000; //!< @brief Maximum altitude in meters.
//! @brief Calculate air densitity at altitude \a H.
//! @throw argument_exception when \a H exceeds ::H_max.
double rho(double H);
} // namespace isa
我希望doxygen放置链接在函数rho(double)的异常描述中将H_max设置为H_max,以将读者定向到该常数。但是只有在我放弃命名空间的情况下它才会这样做,否则自动链接将不起作用。
I would expect doxygen to put a link to H_max at the exception description of function rho(double) to direct the reader to the constant. But it only does if I leave away the namespace, otherwise autolinking does not work.
我在做什么错了?
预先感谢。
推荐答案
好,所以这里的问题不是doxygen的错误行为,而是对方法的误解全局名称空间前缀 ::
起作用。
OK, so the problem here is not a doxygen wrong behavior, but a misunderstanding on how the global namespace prefix ::
works.
:: H_max
标识在全局名称空间中定义的符号,即在任何名称空间中定义的符号。恐怕-如果我错了,请纠正我-您期望它充当父目录 ..
标识符的地方。
::H_max
identifies a symbol defined in the global namespace, that is, out of any namespace. I'm afraid - correct me if I'm wrong - that you where expecting it to behave as the parent directory ..
identifier.
当doxygen处理您提供的代码片段时,它不会在异常描述中链接 :: H_max
,因为它找不到 H_max 变量。如果删除双冒号前缀,则应提供指向 isa :: H_max
的链接。
When doxygen processes the code snippet you provided, it doesn't link ::H_max
in the exception description because it cannot find a H_max
variable in the global namespace. If you remove the double colon prefix, it should provide a link to isa::H_max
.
这篇关于在名称空间中声明的引用静态const变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!