I just saw this thread, describing how to add conditional macros:
Conditional value for #define
but in my case I am defining a function inside a condition.
#if TARGET_IPHONE_SIMULATOR
#define doSomething(){\
\\ does something
}\
#else
#define doSomething(){\
\\ does something else
}\
#endif
This works, except that I call the gcc compiler for this warning:
"doSomething" redefined
This is the location of the previous arguments
Is there a workaround to help get rid of warnings?
UPDATE:
So I tried to include a condition inside my definition:
#define doSomething(){\
#if TARGET_IPHONE_SIMULATOR
\\ do something
#else
\\ do something else
#endif
}\
but this causes an error:
error: '#' is not followed by a macro parameter.
source
share