我已经开始使用Doxygen(预编译1.8.14)为Windows 10上的C项目生成简单的代码文档 .

在头文件中,我定义了三个模板化函数,我的定义放在头文件末尾包含的.tpp文件中 . 看看生成的输出,似乎doxygen不读取此文件 . 因此我总结说doxygen不支持这一点 .

The resulting Doxygen output

但是根据手册(http://www.doxygen.nl/manual/starting.html)它说"Any other extension is parsed as if it is a C/C++ file."这种功能确实没有实现吗?


class IPC {
    template <class T, int N>
    bool setData(std::vector<T> data, Offsets offset);

    template <class T, int N>
    std::array<T, N> getData(Offsets offset);

    template <class T, int N>
    bool getData(std::array<T, N> &data, Offsets offset);

    bool getTrigger(Offsets selector, long timeout_ms = 0);
    void setTrigger(Offsets selector, Status on);

#include "IPC.tpp"


#pragma once
/*! Writes to the shared memory object.

    \param data gives the data that will be written.
    \param offset gives the byte offset from the start of the file.

    \return bool: true on completion

    \sa getData()
template <class T, int N>
bool IPC::setData(std::vector<T> data, Offsets offset) {
    //Calculate the memory block size from the type and number
    unsigned int block_size = sizeof(T) * N;

    //Safety check
    if (block_size + offset > _size) {
        std::cerr << "Error at IPC::setData(): Block size is bigger than memory block size" << std::endl;
        return false;

    if (data.size() < N) {
        std::cerr << "Error at IPC::setData(): Data array is smaller than N" << std::endl;
        return false;

    //Create mapped_region
    mapped_region region(_shm, read_write, offset, block_size);

    for (int i = 0; i < N; i++) {
        std::memcpy((char* ) region.get_address() + sizeof(T) * i, &(data.at(i)), sizeof(T));

    return true;



  • 0

    供将来参考:将 tpp=C++ 添加到 EXTENSION_MAPPING (在doxywizard中的 expert/project 下)和 *.tpp 添加到 FILE_PATTERNS (在doxywizard中的 expert/input 下) .