I´m new into OS develop and i try to run an app but got an error
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_MMPDeepSleepPreventer", referenced from:
objc-class-ref in vista.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is the line of the problem
self.timer = [[MMPDeepSleepPreventer alloc] init];
I trying to run this example
http://blog.marcopeluso.com/2009/08/23/how-to-prevent-iphone-from-deep-sleeping/
If this is not a unit test then you need to make sure that MMPDeepSleepPreventer.m is included in your targets compile sources.
Xcode 4 Instructions:
Project Navigator -> "[Project Name]" -> Under Targets select your
target -> Build Phases -> Expand Compile Sources -> Click + at bottom
of Compile sources and add the source file.
If you continue to get similar errors then make sure all the source files are added and that you have added the necessary frameworks form the tutorial. The place to add frameworks also in the Build Phases of your target.
If this is is a unit test see the answer below the accepted one here.
Related
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AppDelegate", referenced from: objc-class-ref in main.o
ld: symbol(s) not found for architecture x86_64 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
I am trying to use SWRevealViewController in my project, it gives above error.
I dragged and dropped both files i.e. SWRevealViewController.h and SWRevealViewController.m in my project.
If you are using these files in swift project then please make sure #import "SWRevealViewController.h" in your Bridging Header file.
Updated:
Please follows the below steps;
click on the your project name -> Click on Build Phases tab -> Compile Sources and then check to see whether SWRevealViewController.m is actually added to the list. If not, click + button -> Type SWRevealViewController.m -> Select and then Add it.
After that clean the project then again build and run.
Enjoy..!
I've done this before, several years ago with Xcode 5 or 6. Now using Xcode 8 or 9, I seem to be missing someting.
No matter what I've done, when I try to build and link my project, I get the Linker message:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_MyClass", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is not a duplicate question. It is not an architecture issue.
None of the other results I've found on S-O or google resolve this issue.
I'm obviously missing some build settings, but cannot figure out which one(s).
Between build attempts I've cleaned the build folder, and deleted DerivedData. Quit and restarted Xcode. Created a new set of projects with a new workspace and walked through the steps outlined below.
I'm writing in objective-C for this project if that matters (I don't think it does)
My question is what did I forget?
What I did --
Create a project for my framework and static library
a) create the project for a cocoa-touch framework - let's call it mySDK which creates mySDK.framework
b) Add a target for a cocoa-touch static library - let's call it SDK which creates libSDK.a
c) optionally build both targets -- they build fine
d) close the project
Create a project for my application - myApp - then close the project
Create a workspace - myWorkspace -- and open the workspace
Drag both project files from #1 mySDK and #2 myApp into the workspace
Build the framework and static library (both build and create the targets successfully)
Add the static library to myApp
a) Select myApp and go to build phases
b) Open Link Binary with Libraries
c) Drag from the library build products libSDK.a into the link binaries pane, set to "Required"
The library now appears in the Frameworks group-area in the myApp
7) Select the myApp project and go to build-settings
Add to Header Search Paths = "$(SRCROOT)/../mySDK/mySDK"
This resolves compile errors in finding the headers
Now I ask, why do I need to do anything else, shouldn't Xcode figure the rest out?
Various solutions or tutorials I've reviewed suggest adding:
Other Linking Flags = -ObjC
Library Search Paths = $(BUILT_PRODUCTS_DIR)
Library Search Paths = "$(SRCROOT)/../mySDK"
Changing Skip Install from YES to NO
Installation Build Product Location = $(BUILT_PRODUCTS_DIR)
I've tried all of these in different combinations.
Once I added the library to myApp I see that the Frameworks/libSDK.a file changes from red to black when I build the library so something in the workspace/project knows I built the library and it sees it.
So why when I try build myApp, do I still see the liner error:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_MyClass", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Nothing I have done seems to clear that error. I am pulling my hair out trying to find a solution.
I have also checked that it is building all the appropriate architectures, confirmed it using 'lipo -info'
Xcode obviously knows about the library, why isn't it linking?
My app also compiled with no problem but would hit an error while linking to the static library. My library was based on C++.
I had 2 problems to fix in my case:
The headers lacked proper extern "C" declarations for C functions in a C++ file.
One .cpp file did not #include its matching header so the extern "C" would be properly applied to the compiled version.
The linker had issues because the compiler used a mangled name for the function due to the mistakes. Later confirmed this by looking in the .a file with a text editor. I found my function with "_Z11" prefixed and "v" suffixed.
There was another clue: the error was reporting the missing function name with an underscore at the front.
Undefined symbols for architecture arm64:
"_myCFunction", referenced from:
SwiftModule.swiftFunction () -> () in MySwiftClass.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
From this link MediaLibDemos3x , I downloaded source code and I am running it in X-Code 6.3.2 but I am getting following two errors . Can any one check it please give me a solution?
Error 1-
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_BroadcastStreamClient", referenced from:
objc-class-ref in ViewController.o
Error 2-
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It seems the included library are not compiled for i386 (or simulators) so you must run code on real device. See author comment here and here
Undefined symbols for architecture i386
You can get this type of error if your class' .m file is not listed under the "Compile Sources" step of the "Build Phases" tab of your target.
To do this:
Target Settings -> Build Phases -> Compile Sources -> add your .m class ->Build and Run
run your app on device.
i'm using cocoapods for the first time and after everything goes well
i get to run my project that was always wor˚ and got those 2 errors in lin˚er
can anyone please tell me what is it
than˚s
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_PECropViewController", referenced from:
objc-class-ref in addProductViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The addProductViewController object is not found and it was referenced within AppDelegate. You do not link addProductViewController into your app. Check if your Compile Sources section within the Build Phases of your project shows addProductViewController.m
than˚s every body for your help
the problem was with arm 64 i just added it in my target and everything work fine
in architectures filed add standard architectures armv7,arm64
I just finished installing CocoaPods. My app target builds and runs.
I added a link_with line in my Podfile to allow cocoapods to also add the frameworks to my Tests target. Now I get some linker errors when trying to run tests. I was able to resolve a missing XCTest error by specifying the XCTest framework in other linker flags as in the picture.
I'm still left with this, which is a reference to a class in my project. There are a couple other references to other classes in my tests that don't seem to cause an error, I can see nothing different ServerController.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ServerController", referenced from:
objc-class-ref in TestServerController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here's my header search paths:
To me, this looks like you're trying to compile and run tests on the simulator without actually building for the simulator's processor architecture.
Your test project might have i386 listed as a valid architecture, but does your main project have it listed there as well?
Check Valid Architectures in your build settings for your product's target and make sure i386 is listed as a valid architecture, then clean and build for testing again.