I have a typical c++ project going where you end up with a .h and .ccp file for every class.
I have these files arranged in directories on disk with one h.h file including the others in the directory.
The files in the directory include the single .h file, which includes the next level up's file.
Basically its one big tree structure of included files.
I use header guards in every .h file.
For example:
main.cpp includes core/core.h. core.h includes network/network.h (as well as other directories). network.h includes ../core.h and subdirectories like records/records.h. records.h include ../network.h and the .h files in the directory.
99.99% of the time I have no problems at all. Occasionally I have a random cpp file that when compiled can't find something defined in a .h file even when I include it directly (typically I just include one .h file in all of my .cpp files). It behaves like the header guard is already defined causing it to skip the contents, but I triple verified that it is not. Many times though including the root .h file in the troublesome cpp file resolves the issue.
Are there some quirks in "#ifndef my_file_h #define my_file_h" that cause it to fail in gcc and llvm?
Whats really maddening though is if I comment out the header guard it will complain about it being defined twice instead of not being defined at all.
--and it always works fine in all of the other cpp files, just not that one (every .h file is technically included in every .cpp file because of the bidirectional tree hierarchy of includes).