我将项目更新为 Xcode 5 并在build设置中启用了模块。
但是,当我使用 @import
时,我看到编译器错误 Unexpected '@' in program
。
#ifndef __IPHONE_7_0
#warning "This project uses features only available in iOS SDK 7.0 and later."
#endif
#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#endif
#ifdef __OBJC__
@import SystemConfiguration;
@import UIKit;
还有什么需要做的吗?
最佳答案
从@hw731
的评论我认为你使用不好@import
:
导入框架的旧语法:
#import <UIKit/UIKit.h>
但是现在,您可以使用新的语法:
@import UIKit;
您需要启用这些模块以使用关键字 @import
(当您使用 Xcode 5 创建新项目时默认启用):
看看here .
关于ios - @导入 "Unexpected ' @' in program",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19272683/