Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on List what file(s) an identifier was declared in?
Parent
List what file(s) an identifier was declared in?
I'm using Doxygen to help me figure out some library code. There's an enum
I know I need to use, but I don't know which file it's declared in.
Searching for that identifier in Doxygen yields the page for the whole namespace in which it is declared. If I click on it in the summary at the top of the page, to go to the detailed info, I get only the signature and table of what's in the enum
.
Is there any way to make it also show which file(s) the enum
was declared in?
For classes that have their own page, there is indeed text at the bottom saying "The documentation for this class was generated from the following files:" and then a list of the relevant files, and that's very useful. enum
s and the like do not get their own page, however.
In this case I'll probably end up just using a tool like grep
to find it, but if anyone knows a way to get this info to show up in the Doxygen output that would be super helpful.
Post
I haven't used Doxygen that much, but after checking the documentation and looking around online, it looks like the reason this might be happening is because the SHOW_USED_FILES
setting which (if I'm reading the documentation correctly) is used to show the list of files at the bottom of a page of documentation appears to be limited to the documentation of classes and structs.
In other words, if an enum
is not particularly in a class, and if it's not somehow a struct
, the outputted documentation page should not include this list of source files.
I tried out a test using C language files with an enum
and a struct
. When I tried just using an enum
definition in my header file, I did not see the The documentation for this struct was generated from the following file:
line from the bottom of the generated Doxygen page. When I included a struct definition in my header file, I finally noticed that the resulting page was under the Classes
menu on the documentation generated by Doxygen. After clicking on the Classes
menu and then clicking on the name of the struct
I used, I was able to see the The documentation for this struct was generated from the following file:
line at the bottom of the generated documentation.
Thus, from what I read in the documentation, it looks like a plain enum
file is not meant to show the The documentation for this struct was generated from the following file:
line. If your enum
could somehow be a part of a class, however, like in this example from the documentation, it should work!
For reference, here are the C files I used for my tests:
q12.h
#include <stdio.h>
#include <string.h>
// ref: https://docs.microsoft.com/en-us/cpp/c-language
// /c-enumeration-declarations?view=msvc-160
enum COLOR
{
Red, /*!< Enum value red. */
Blue, /*!< Enum value blue. */
Yellow /*!< Enum value yellow. */
};
// ref: https://www.tutorialspoint.com/cprogramming/c_structures.htm
struct Colors {
char name[30]; /*!< Struct name. */
};
q12.c
#include <stdio.h>
#include "q12.h"
int main()
{
// ref: https://docs.microsoft.com/en-us/cpp/c-language
// /c-enumeration-declarations?view=msvc-160
enum COLOR primary = Red;
// ref: https://www.tutorialspoint.com/cprogramming/c_structures.htm
struct Colors Color1;
strcpy(Color1.name, "Red");
printf("Hello, world!\n");
printf("Printing color: %d\n", primary);
return 0;
}
0 comment threads