第一章 第九节 如何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
#ubuntu中需要用sudo,否则安装没有用户权限
$sudo 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. 生成的网页是

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值