What are the GCC default include directories?

Raxvan picture Raxvan · Feb 12, 2011 · Viewed 91.2k times · Source

When I compile a very simple source file with gcc I don't have to specify the path to standard include files such as stdio or stdlib.

How does GCC know how to find these files?

Does it have the /usr/include path hardwired inside, or it will get the paths from other OS components?

Answer

Ihor Kaharlichenko picture Ihor Kaharlichenko · Jul 12, 2011

In order to figure out the default paths used by gcc/g++, as well as their priorities, you need to examine the output of the following commands:

  1. For C:
    gcc -xc -E -v -
  1. For C++:
    gcc -xc++ -E -v -

The credit goes to Qt Creator team.