On Thu, Mar 28, 2013 at 8:35 AM, Miguel Guedes <miguel.a.guedes@xxxxxxxxx> wrote: > > In order to find out what the system include directories are, I can run > `cpp -v </dev/null' or compile a test program with GCC (i.e. gcc -v > test.c). This works fine but unfortunately I'm in need of a programmatic > way of finding out what the system include directories are without > resorting to launching external programs. > > Anyone knows how GCC determines the directories? They are constructed at the time that GCC is compiled, based on the configure option. They are also affected by any -B option, the INCLUDE_PATH environment variable, options like -nostdinc, and obviously options like -I, -iquote, --sysroot, etc. So really computing the set of directories is pretty hard, and I would recommend invoking gcc -v and parsing the output. Ian