简体   繁体   中英

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”.

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. You need to link your app to UIKit:

  • Select the project in the project navigator (cmd+1, top left in left panel)
  • Select the target (ie your app) under 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

Once that is completed, there may be new link issues which are discovered.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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