Search code examples
cheader-filesdoxygen

.h file not given a clickable link in HTML Doxygen


I'm documenting a C project in Doxygen, and I have one header file with definitions that does not have a corresponding .c-file.

When I go into the generated HTML documentation, under the files tab, it looks like this: enter image description here

definitions.h is clearly not clickable. The file looks like this:

/** 
 * @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

My file tree looks like this:

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

And I've set

INPUT = ./src ./includes

Any ideas on how to fix this?

EDIT Output from running doxygen -x Doxyfile is:

# 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

Solution

  • This looks like a user error. When all is OK you should also have gotten the warning:

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

    In the tree we see the file definitions.h but in the file itself we see: @file definitons.h, note the missing i after the t. (at first I missed the missing i as well as I used the filename from a cut/paste of the @file).

    Note also that when the @file command is in the file itself it is not necessary to specify the file name. So in this case @file would have been sufficient. From the documentation:

    \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.