gcc/xCode — #include that does not trigger an error (or warning) if the file does not exist?
-
29-10-2019 - |
문제
Is this possible?
Basically, what I want to do is something like this:
#includeIfItExists "header.h"
and if header.h does not exist, the compiler simply continues on its merry way.
해결책
I'm by no means an expert C guy but I don't believe that this is possible natively. I think the recommend route would be to pass in a named macro at the compiler level using -D
and if it is (or possibly is not) defined perform your include. This way the person compiling the program has to make a conscious decision to skip the include (or include it).
제휴하지 않습니다 StackOverflow