Skip to content
Advertisement

What are the GCC default include directories?

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?

Advertisement

Answer

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.

Advertisement