How to properly alias a system header file for inclusion as <foo.h>?

  aliasing, c++, c++11

Suppose I’ve written a header named foo.h, and that foo.h is also the name of one of the headers under /usr/include. Now, in my source files, I want to say #include <foo.h>, but arrange my build so that the compiler will search the directory with my foo.h before /usr/include. It is almost important that users be able to write <foo.h> instead of "foo.h".

How do I arrange this in the C or C++ compiler command-line (e.g. with GCC, clang)?

Source: Windows Questions C++

LEAVE A COMMENT