简体   繁体   English

xcode 6,ios 8,object-C ++

[英]xcode 6, ios 8, object-C++

I create a new app project(not library or framework), and then I set "compile source as" as object-C++.But when I compile the source, it shows “build failed”. 我创建了一个新的应用程序项目(不是库或框架),然后我将“compile source as”设置为object-C ++。但是当我编译源代码时,它显示“build failed”。

The error is : 错误是:

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_UIResponder", referenced from:
      _OBJC_CLASS_$_AppDelegate in AppDelegate.o
  "_OBJC_METACLASS_$_UIResponder", referenced from:
      _OBJC_METACLASS_$_AppDelegate in AppDelegate.o
  "_UIApplicationMain", referenced from:
      _main in main.o
  "_OBJC_METACLASS_$_UIViewController", referenced from:
      _OBJC_METACLASS_$_ViewController in ViewController.o
  "_OBJC_CLASS_$_UIViewController", referenced from:
      _OBJC_CLASS_$_ViewController in ViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

but what makes me confused is that : if it is a framework project,it compiles well. 但令我困惑的是:如果它是一个框架项目,它编译得很好。 Could you lend me a hand ! 你能救我一把手!

Your app's missing symbols from UIKit. 您的应用程序缺少来自UIKit的符号。 You need to link your app to UIKit: 您需要将您的应用程序链接到UIKit:

  • Select the project in the project navigator (cmd+1, top left in left panel) 在项目导航器中选择项目(cmd + 1,左侧面板左上角)
  • Select the target (ie your app) under TARGETS 选择TARGETS下的目标(即您的应用)
  • Click "Build Phases" tab 单击“构建阶段”选项卡
  • Click the "Link Binary with Libraries" disclosure triangle, unless the table is already visible 单击“链接二进制文件库”显示三角形,除非该表已经可见
  • Click the '+' at the bottom of the table 单击表格底部的“+”
  • Double click UIKit.framework to add it to your link stage 双击UIKit.framework将其添加到链接阶段

Once that is completed, there may be new link issues which are discovered. 完成后,可能会发现新的链接问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM