SteakOverflow
SteakOverflow

Reputation: 2033

Doxygen: document a class in the cpp file with separate source and header directories while using macros to define namespaces

I'm trying to document a library with the following files:

include/mylib/mylib_global.h
include/mylib/SomeClass.h
source/SomeClass.cpp
Doxyfile

include/mylib/mylib_global.h:

#pragma once
#define MYLIB_NAMESPACE_BEGIN namespace mylibns {
#define MYLIB_NAMESPACE_END   }

include/mylib/SomeClass.h:

#pragma once
#include "mylib_global.h"

MYLIB_NAMESPACE_BEGIN

class SomeClass
{
public:
    SomeClass();
};

MYLIB_NAMESPACE_END

source/SomeClass.cpp:

#include "mylib/SomeClass.h"

MYLIB_NAMESPACE_BEGIN

/*!
 * \class SomeClass
 * This is a sample class.
 */

/*!
 * This is a constructor.
 */
SomeClass::SomeClass()
{
}

MYLIB_NAMESPACE_END

Doxyfile:

PROJECT_NAME = mylib
INPUT = .
RECURSIVE = YES
MACRO_EXPANSION = YES

Doxygen produces the following warning:

Doxygen version used: 1.9.3 (c0b9eafbfb53286ce31e75e2b6c976ee4d345473)
[...]
include/mylib/SomeClass.h:7: warning: Compound mylibns::SomeClass is not documented.
*** Doxygen has finished

If I do any of the following, it works:

Things that don't help:

How do I do this properly?

Upvotes: 0

Views: 785

Answers (1)

albert
albert

Reputation: 9037

In the file source/SomeClass.cpp you have:

#include "mylib/SomeClass.h"

but the file SomeClass.h is located in include/mylib so you have to tell doxygen where to find the include file. This can be done by means of the setting:

INCLUDE_PATH = include

(analogous what you probably have done for the compiler with the setting like -I include)

Upvotes: 1

Related Questions