Recently I run into the following problem:
A source file included a header with a non unique file name.
The build suceeds if the Include paths are given in the correct order.
I would like to be warned at compile time if multiple files with the same names exists in the include paths. Please refer to my minimal example for details.Does a compiler flag for this purpose exits ?
Minimal example:
file tree
.├── a│└── h.hxx├── b│└── h.hxx└── main.cxx
a/h.hxx
#ifndef __H_HXX__#define __H_HXX__namespace important { struct Foo { int bar; };}#endif
b/h.hxx
#ifndef __H_HXX__#define __H_HXX__namespace uselesss {}#endif
main.cxx
#include "h.hxx"namespace important { void bar(){ Foo x; }}int main(){ important::bar(); return 0;}
compiler invocation
g++ -I a -I b main.cxx
<- will work, but i would like to be warnedg++ -I b -I a main.cxx
<- will fail, fine >> problem can be fixxed immediatly
Thank you