Amomum
Amomum

Reputation: 6503

How to find where header is included

I'm having some nasty error with one header file being included with different linkages (namely, stdio.h with and withoun "extern C"). So, I need to find where one specific header file is included.

I am aware of doxygen but unfortunately the header I'm interested is stdio.h, which is also included by Qt. So the only way (that I'm familiar with) to use doxygen - is to scan entire Qt folder. That could take forever.

So, is it possible to find out, where one header is included, without drawing include graphs for every headers in the project? Or is there some other way of solving this?

Upvotes: 1

Views: 167

Answers (2)

Mine
Mine

Reputation: 4241

You can try gcc -E to preprocess the file and see where the header file comes from;

Or you can just search your -Ipath where the header file is.

Upvotes: 2

Rob K
Rob K

Reputation: 8926

I'd use grep:

grep --color --binary-files=without-match -R -n -i "stdio.h" *

that will recursively search down a tree, examining every text file for stdio.h, printing each match with the file name and line number where it was found.

Upvotes: 0

Related Questions