Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implicit declaration of function 'DLog' is invalid in C99

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.

like image 738
Hemang Avatar asked Dec 01 '22 18:12

Hemang


1 Answers

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.

like image 192
Nirav Gadhiya Avatar answered Dec 09 '22 16:12

Nirav Gadhiya