Andreas Andreas - 3 months ago 18
Objective-C Question

gcc define for Objective C

I have a header file that is included by

*.c
and by
*.m
sources. When a C source includes the file, I'd like to skip some lines that contain Objective C stuff. Thus, I was wondering if gcc has a builtin compiler define that is active whenever it is compiling an Objective C file, something similar to the
__cplusplus
define that indicates that the compiler is currently compiling a C++ source. Is there an Objective C equivalent?

Of course, I could just
#define
my own preprocessor symbol but I'd like to know whether gcc already has an inbuilt definition for this.

Answer

To answer my own question, gcc defines then __OBJC__ macro whenever it is compiling an Objective C source.

Comments