Reading the fine print of the -I
switch in GCC, I\'m rather shocked to find that using it on the command line overrides system includes. From the preprocessor docs
What legitimate reasons are there for -I
over -iquote
? -I
is standardized (at least by POSIX) while -iquote
isn't. (Practically, I'm using -I
because tinycc (one of the compilers I want my project to compile with) doesn't support -iquote
.)
How do projects manage with -I
given the dangers? You'd have the includes wrapped in a directory and use -I to add the directory containing that directory.
includes/mylib/endian.h
-Iincludes
#include "mylib/endian.h" //or
With that, as long as you don't clash on the mylib
name, you don't clash (at least as far header names are concerned).