@import" Unexpected'@'in program" [英] @import "Unexpected '@' in program"

查看:1257
本文介绍了@import" Unexpected'@'in program"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将项目更新为Xcode 5并在构建设置中启用了模块。
但是,当我使用 @import 时,我在程序中看到编译器错误 Unexpected'@'。

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&quot; Unexpected'@'in program&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆