第九节 如何Doxygen为代码生成html文档-闫刚


Doxygen是一款文档生成工具,它可以从代码中提取出相应的文档,并组织,输出成各种漂亮的文档(如HTML,PDF,RTF等),doxygen让你变成一位有品位的程序猿。

1. 安装doxygen工具

$git clone https://github.com/doxygen/doxygen.git
$cd doxygen
$mkdir build
$cd build
$cmake -G "Unix Makefiles" ..
$make
$make install 

2. 修改我们之前的代码wheel_messg.h文件  代码仓库地址: https://github.com/yangang123/cpp_test/tree/doxygen/orb_sim

  • 修改前:我们没有对数据类型和函数接口进行任何说明

#ifndef _WHEEL_MESG_H
#define _WHEEL_MESG_H

#include <stdint.h>
#include <stdbool.h>

typedef struct {
     bool val;
}wheel_mesg_s;

void wheel_orb_publish (wheel_mesg_s * msg);
void wheel_orb_check ( bool * update);
void wheel_orb_copy (wheel_mesg_s * msg);

#endif /* _WHEEL_MESG_H */


  • 修改后 : 我们添加一下代码的创建时间和函数接口说明

//***************************************************************************************
//
//! \file wheel_mesg.h
//! 实现转轮消息的发送和接收
//!
//! \author yangang
//! \version V1.0
//! \date 2018-04-23
//! \copyright GNU Public License V3.0
//
//**************************************************************************************

#ifndef _WHEEL_MESG_H
#define _WHEEL_MESG_H

#include <stdint.h>
#include <stdbool.h>


/*!
* Base object class.
*/
typedef struct {
     bool val; /*!< an bool value */
}wheel_mesg_s;

//***************************************************************************************
//
//! \brief 消息发布
//!
//! \param wheel_mesg_s *msg:消息.
//! \retval none.
//!
//! \note
//
//***************************************************************************************
void wheel_orb_publish (wheel_mesg_s * msg);

//***************************************************************************************
//
//! \brief 消息检测
//!
//! \param bool *update : 是否更新.
//! \retval none.
//!
//! \note
//
//***************************************************************************************
void wheel_orb_check ( bool * update);


//***************************************************************************************
//
//! \brief 消息拷贝
//!
//! \param none.
//! \retval none.
//!
//! \note
//
//***************************************************************************************
void wheel_orb_copy (wheel_mesg_s * msg);

#endif /* _WHEEL_MESG_H */

3. 使用doxygen生成html文件

 doxygen -g
 doxygen Doxyfile 

4. 在html文件夹中找到index文件



4. 生成的网页是


猜你喜欢

转载自blog.csdn.net/yangang185/article/details/80053789