Xcode 6, ios 8, Object-C ++
I create a new application project (not a library or framework) and then I set "compile source as" as a C ++ object. But when I compile from source it shows "build failed".
Mistake:
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 confuses me is that: if it is a framework project, it compiles well. Could you please lend me your hand!
+3
source to share
1 answer
Your app is missing characters from UIKit. You need to link your app to UIKit:
- Select the project in the project navigator (cmd + 1, top left in the left pane)
- Select the target (i.e. application) in the TARGETS section
- Click the Generate Phases tab.
- Click the Link Libraries disclosure triangle if the table is no longer visible.
- Click the "+" at the bottom of the table.
- Double click on UIKit.framework to add it to the link stage.
Once this is complete, new link issues may arise.
+13
source to share