预编译头中的#define在.mm文件中无法识别

时间:2011-04-15 23:36:23

标签: c++ objective-c cocoa xcode ios

.mm文件为什么不能识别.pch中的#define语句?

在尝试引用宏时导致“使用未声明的标识符”和“未在此范围内声明”。

Pch看起来像这样:

#import <Availability.h>

#ifndef __IPHONE_3_0
#warning "This project uses features only available in iPhone SDK 3.0 and later."
#endif

#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif

#ifdef DEBUG
#define dNSLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#else
#define dNSLog(format, ...)
#endif

2 个答案:

答案 0 :(得分:3)

我有同样的问题,清洁没有解决它。

关闭并重新启动Xcode 4后,一切都很好。 如果这可以帮助某人......

答案 1 :(得分:0)

原来Xcode 4实际上并没有清理构建。 :(