14

Our dev environment makes heavy use of directories with locally modified headers that should be seen by the compiler instead of the "committed" "repository" versions.

If header A includes header B, gcc looks for B in the same directory A was in and does not obey the seach path. So we used the -I- option on gcc to prevent that. Gcc will strictly follow the hierarchy of the include-path then. As with gcc4 the -I- option is deprecated and repaced by -iqoute. I can't figure out how to get the same behaviour with the -iquote option because I think it is lacking the side-effect of disabling the search in the "current" directory.

see http://gcc.gnu.org/onlinedocs/cpp/Invocation.html#Invocation

Any ideas how to achieve the same behaviour?

1 Answer 1

10

AFAIK, there is no other way to desactivate the behaviour you are complaining about other than using the form #include <foo.h> instead of #include "foo.h" in your code.

ISTR, but I've failed to find a reference, that the rationale for deprecating -I- without providing another mechanism for that aspect is that libraries commonly use the form #include "foo.h" to ensure they get their own internal header file foo.h and the use of -I- broke them in some cases if someone else happened to have a file similarly named earlier on the search path.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.