.h 文件未在 HTML Doxygen 中提供可点击的 link

.h file not given a clickable link in HTML Doxygen

我正在 Doxygen 中记录一个 C 项目,我有一个头文件,其中的定义没有相应的 .c 文件。

当我进入生成的 HTML 文档时,在文件选项卡下,它看起来像这样:

definitions.h 显然是不可点击的。 该文件如下所示:

/** 
 * @file definitons.h
 * \brief Header file containing the useful definitions that are to be used in all 
 * files across the program
 */
#ifndef DEFINITIONS_H
#define DEFINITIONS_H

/* CONSTANTS AND DEFINES */
#define SUCCESS 0                                       ///< A function returns 0 when it has succeeded
#define BYTES_PER_SECOND 4096                           ///< The chip takes 2048 samples per second. Each sample is 14 bytes, but data is sent as bytes, and therefore 4096 bytes have to be sent/received per second
#define SECONDS_PER_BUFFER 2                            ///< The number of seconds one wants to measure at once
#define BUF_SIZE BYTES_PER_SECOND*SECONDS_PER_BUFFER    ///< The total buffer size

#include <pthread.h>


/* STRUCTS */
/**
 * \brief Custom struct needed to pass three mutexes as arguments to
 * the thread functions using pthread
 */
typedef struct MTX_ARGS{
    ///Mutex used for setting global variable indicating program should be exited.
    pthread_mutex_t* esc_mtx;
    ///Mutex used for protecting @ref buffer1
    pthread_mutex_t* buf_1_mtx;
    ///Mutex used for protecting @ref buffer2 
    pthread_mutex_t* buf_2_mtx;
} MTX_ARGS;

#endif

我的文件树是这样的:

project
│   Doxyfile
└───src
│   │   main.c
│   │   datawrite.c
│   │   serialread.c
│   
└───includes
    │   datawrite.h
    │   serialread.h
    │   definitions.h

我已经设置了

INPUT = ./src ./includes

关于如何解决这个问题有什么想法吗?

编辑 运行 doxygen -x Doxyfile 的输出是:

# Difference with default Doxyfile 1.9.1 (ef9b20ac7f8a8621fcfc299f8bd0b80422390f4b)
PROJECT_NAME           = "C code for reading samples from an nRF52832 chip"
OUTPUT_DIRECTORY       = ./docs
OPTIMIZE_OUTPUT_FOR_C  = YES
INPUT                  = ./src \
                         ./includes
SOURCE_BROWSER         = YES
INLINE_SOURCES         = YES

这看起来像是用户错误。当一切正常时,您也应该收到警告:

warning: the name 'definitons.h' supplied as the argument in the \file statement is not an input file

在树中我们看到文件 definitions.h 但在文件本身中我们看到:@file definitons.h,请注意 t 之后缺少的 i。 (起初我错过了丢失的 i 以及我使用的文件名 @file 的 cut/paste).

另请注意,当 @file 命令在文件本身中时,无需指定文件名。所以在这种情况下 @file 就足够了。 来自文档:

\file [<name>]

Indicates that a comment block contains documentation for a source or header file with name <name>. The file name may include (part of) the path if the file-name alone is not unique. If the file name is omitted (i.e. the line after \file is left blank) then the documentation block that contains the \file command will belong to the file it is located in.