It's not an entirely optimal solution, but if you simply want to ensure that you get the desired version of the header without modifying the code, you could try using a combination of the -nostdinc
and -nostdinc++
with a -I/usr/include
flag. If I understand the documentation correctly, that should prevent gcc from looking at the standard list of system header files and instead defer to those supplied with the -I
flag. That should override Os X's decision to automatically include the backward compatibility directory on the header search list.
There is the possibility however, that with those options you will be unable to compile. GCC has provisions for the case where you supply a directory with the -I
flag that are already present on the default system header search list (it will ignore the extraneous -I
flag). Hopefully it is smart enough to notice that the system search list has been cleared (by the -nostdinc
flags), allowing it to property add -I/usr/include
.