【问题标题】:Doxygen not producing correct inheritance structure when using codeblocks 13.12使用代码块 13.12 时,Doxygen 不会产生正确的继承结构
【发布时间】:2023-03-18 05:59:01
【问题描述】:

我正在尝试在下面的 c++ 中获取这个简单的类结构,以生成正确的 doxygen html 文件。我正在使用 codeblocks 13.12 的提取文档来生成 doxyfile。比我在代码块中使用 doxywizard 功能来调用 macport 的 doxygen 版本 1.8.7。每次我生成一个 doxygen html 输出时,class Rider 中的 new_instance 方法都会丢失。有没有办法来解决这个问题?我是不是做错了什么?

class cowboy /** a class to store and utilize horses */
{
public:
    virtual ~cowboy() {}

    int horse; /**< an integer that counts the number of horses the cowboy owns */

    /** @brief prints the number of horses
     *
     */
    void print()
    {
        std::cout<< "I ride a horse and own " << horse << " horses.\n";
    }

    /** \brief creates a new instance of cowboy
     *
     * \return cowboy* the location the new instance of cowboy is stored
     *
     */
    virtual cowboy* new_instance() //operates with factory
    {
        return new cowboy;
    }
};

class rider: public cowboy /**an object that also owns horses but is not as cool as a cowboy  */
{
     /** @brief creates a new instance of rider as a cowboy pointer
     *
     * @return cowboy* the location the new instance of rider is stored
     *
     */
    cowboy* new_instance()
    {
        return new rider;
    }
};

可能有帮助的其他信息。我拥有的代码块版本是 32 位应用程序,您可以直接从代码块的网站下载。操作系统是 Mountain Lion,以防此问题特定于该版本的操作系统。

【问题讨论】:

    标签: c++ doxygen


    【解决方案1】:

    原来问题是由于将继承结构放在同一个文件中造成的。我不确定它是 .h 文件还是 .cpp 文件是否重要。就我而言,我使用的是 .cpp 文件。问题是当放在同一个文件中时,doxygen 没有将 new_instance 识别为上述代码中的重新实现。此外,如果您从牛仔中删除 new_instance,骑士中的 new_instance 仍然不会出现在 doxygen 创建的 html 文件中。要解决此问题,需要将每个类拆分为 .h/.cpp 文件。拆分后,doxygen 创建的 html 文件可以正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-22
      • 1970-01-01
      • 2011-01-17
      • 1970-01-01
      相关资源
      最近更新 更多