[objective-c]使用Lumberjack未定义

来源:互联网 发布:js防水材料生产工艺 编辑:程序博客网 时间:2024/06/11 09:19

1.use of undeclared identifier 'ddLogLevel'

在项目的pch文件中,(没有自己新建一个,并添加到工程中)

 #ifdef __OBJC__    #import <UIKit/UIKit.h>    #import <Foundation/Foundation.h>    #import "DDLog.h"#endif#ifdef DEBUG    static const int ddLogLevel = LOG_LEVEL_VERBOSE;#else    static const int ddLogLevel = LOG_LEVEL_WARN;#endif

2.use of undeclared identifier 'LOG_LEVEL_VERBOSE'

 新建Constants.h & Constants.cpp,并把Constants.h加入pch文件中,在Constants.h中,加入

extern int ddLogLevel;

Constants.cpp加入

int ddLogLevel =#ifdef DEBUG                 LOG_LEVEL_VERBOSE;#else                 LOG_LEVEL_ERROR;#endif

同时去掉 pch中ddLogLevel的定义。

备注:不建议在pch文件中,使用定义,在编译时会被每个文件包含。



ref:http://stackoverflow.com/questions/25112833/what-can-be-the-cause-of-use-of-undeclared-identifier-log-level-verbose-messag

0 0
原创粉丝点击