I used a macro version of NSLog from here, http://objdev.com/2014/06/debug-logging
like this,
#ifdef DEBUG
#define DLog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__])
#endif
It was working fine, until I changed the app run mode from Debug
to Release
.
Now I get the following error:
Implicit declaration of function 'DLog' is invalid in C99.
How do I solve this?
I read many questions, error:'implicit declaration of function 'nslog' is invalid at C99', ARC warning: Implicit declaration of function 'DLog' is invalid in C99 and Implicit declaration of function - C99, but none of the answers work for me.
P.S. This question isn't related to CocoaLumberjack at all.
Error tells you that DLog
doesn't have any definition in Release
Mode.
Just change it to this:
#ifdef DEBUG
#define DLog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__])
#else
#define DLog(...)
#endif
EDIT : If it is a Release mode DLog will do nothing(A Blank Function). And if it is a debug mode DLog will print the log as per your requirements.