@import "程序中出现意外的 '@'"; [英] @import "Unexpected '@' in program"
本文介绍了@import "程序中出现意外的 '@'";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将项目更新到 Xcode 5 并在构建设置中启用模块.但是,当我使用 @import
时,我看到编译器错误 Unexpected '@' in program
.
I updated project to Xcode 5 and enabled modules in build settings.
However, I see compiler error Unexpected '@' in program
when I use @import
.
#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
:
From the comment of @hw731
I think you use badly @import
:
导入框架的旧语法:
#import <UIKit/UIKit.h>
但是现在,您可以使用新语法:
but now, you can use the new syntax :
@import UIKit;
您需要启用这些模块以使用关键字 @import
(当您使用 Xcode 5 创建新项目时默认启用):
you need to enable theses modules to use the keyword @import
(it's enable by default when you create a new project with Xcode 5) :
看看这里.
这篇关于@import "程序中出现意外的 '@'";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文