簡體   English   中英

Doxygen —如何鏈接到C ++文件范圍的全局變量

[英]Doxygen — How to link to a C++ file-scope global variable

我有一些看起來像這樣的代碼:

MyStruct.h

struct MyStruct
{
    // ...

    /**
      * \brief Initializes \link MYSTRUCT \endlink.
      */
    static void init();
};

/**
 * \var MYSTRUCT
 * \brief You must call MyStruct::init() before using this variable.
 */
extern MyStruct const * MYSTRUCT;

我想對Doxygen文檔MyStruct::init鏈接對Doxygen文檔MYSTRUCT 但是,Doxygen無法解析鏈接,因為我提供了它。 我需要做什么才能使鏈接正常工作?

注意:Windows 7上的Doxygen v 1.8.4

這是應該工作的更正示例。 請注意,我在\\ file中添加了一個注釋塊(並刪除了多余的\\ var)

/** \file */

/** My struct documentation */
struct MyStruct
{
    // ...

    /**
     * \brief Initializes \link MYSTRUCT \endlink.
     */
    static void init();
};

/**
 * \brief You must call MyStruct::init() before using this variable.
 */
extern MyStruct const * MYSTRUCT;

如果您不希望頁面包含全局數據,但希望MYSTRUCT作為MyStruct文檔的一部分出現,則可以使用\\ relates,如下所示:

/** My struct documentation */
struct MyStruct
{
  // ...

  /**
   * \brief Initializes \link MYSTRUCT \endlink.
   */
  static void init();
};

/**
 * \brief You must call MyStruct::init() before using this variable.
 * \relates MyStruct
 */
extern MyStruct const * MYSTRUCT;

並且您可以將#MYSTRUCT用作\\link MYSTRUCT \\endlink

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM