I am using C/C++ Eclipse. Is there an option in the IDE or an external tool to figure out the chain as to how a header file is eventually being included?
Asked
Active
Viewed 188 times
3
-
MSVS has an option that does just that. – Luchian Grigore Jan 21 '14 at 15:58
-
@LuchianGrigore Clarify? – Proxy Jan 21 '14 at 15:59
-
@LuchianGrigore I know MSVS has that option, but I'm using Eclipse – Iceman Jan 21 '14 at 15:59
-
2http://stackoverflow.com/questions/5834778/g-how-to-tell-where-a-header-file-is-included-from – Bill Jan 21 '14 at 16:00
-
@Iceman MSVC counts as an "external tool", doesn't it? – JBentley Jan 21 '14 at 16:06
2 Answers
2
You could just put an #error
in the header file, the compiler should give you a trace like:
In file included from someheader.h:1:0,
from myheader.h:1,
from mysourcefile.c:1:
header_im_tracing.h:1:2: error: #error foobar

remram
- 4,805
- 1
- 29
- 42
-
No it didn't show the complete chain.. only the header file and the parent source file. – Iceman Jan 21 '14 at 16:22
-
That depends on your compiler (not your IDE), on MinGW it does. Oh well :] – remram Jan 22 '14 at 18:56
1
An alternative would be to remove such header and try to build your project. Your compiler will (likely) show you the include chain.

Salsa
- 917
- 2
- 13
- 22