I am looking to print a list of absolute paths to a specific header file used by gcc
without compiling anything (or specifying a particular compile target, like with gcc -M
). E.g., the following would print a list of absolute paths with all matches for limits.h
found in the appropriate directories:
gcc <flag/command> limits.h
A (non-)solution that returns only working header files is to simply create a check.c
, #include
all desired header names there, and run gcc -M check.c
.
Another solution, (albeit using bash stuff) is found in this answer and here.
Related questions that didn't quite have what I want:
- How can I see the location of a header included with #include?
- Where does gcc look for C and C++ header files?
- How to I find the filename of a library via the library name?
- How can I find the full file path given a library name like libfoo.so.1?
gcc -print-file-name=libc.a
prints absolute path in the strange form