DreamRunner
DreamRunner

Reputation: 71

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 !

Upvotes: 5

Views: 2063

Answers (1)

justin
justin

Reputation: 104698

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 (i.e. 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.

Upvotes: 18

Related Questions