Where are header files for GCC located?
36,348
Solution 1
First take a look in /usr/include
or /usr/local/include
.
If you find nothing there, try :
`gcc -print-prog-name=cc1plus` -v
This command asks gcc which C++ preprocessor it is using, and then asks that preprocessor where it looks for includes.
You will get a reliable answer for your specific setup.
Likewise, for the C preprocessor:
`gcc -print-prog-name=cc1` -v
Solution 2
To look for header locations just use the locate command:
locate -b '\math.h'
locate -b '\graphics.h'
or a simpler approach
locate \*/math.h
locate \*/graphics.h
If you are more familiar with regular expression use
locate -r \/math.h$
To make sure the database is up-to-date start:
sudo updatedb
That's the way I'm searching my headers location. It's much faster than using the find command.
Related videos on Youtube
Author by
Chirag Soni
Updated on September 18, 2022Comments
-
Chirag Soni over 1 year
I want to manually add some header files like
math.h
andgraphic.h
forgcc
but don't know where to put them. -
Knud Larsen about 6 years
math.h
should already be present. Example :/usr/include/c++/7.3.0/math.h
-
user001 over 4 yearsHow does the backslash act to prevent matching by files with preceding characters in their basename? The string
\math.h
should evaluate tomath.h
, but I see that\math.h
avoids matching files liketgmath.h
andquadmath.h
. -
abu_bua over 4 yearsFROM 'man locate' : To search for a file named exactly NAME (not *NAME*), use locate -b '\NAME' Because \ is a globbing character, this disables the implicit replacement of NAME by *NAME*.
-
user001 over 4 yearsThanks. I had checked
man locate
, but I guess I have a different version of thelocate(1)
man page (which doesn't have one instance of\
). -
abu_bua over 4 years
info locate
or man7.org/linux/man-pages/man1/locate.1.html