Apple Mach-O Linker Error with project from GitHub - ios

I'm attempting to run a project from git hub (https://github.com/dulaccc/DPMeterView). The issue arises after cloning the repository and using 'pod install' to install the dependencies. I'm receiving this error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_DPMeterView", referenced from:
objc-class-ref in ViewController.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'm having a tough time finding a solution. Any thoughts? Thanks in advance!

Since the obvious solution hasn't been written as an answer, I will do that.
Anytime you get an "undefined symbol" error, that indicates that you have not told the linker to add that symbol to your binary. How do you tell the linker to add it? Well, perhaps the easiest way is to tell the compiler to build your source file.
In Xcode, this is done in the Compile Sources pane, which looks like this:
On the command line, you can do it like this:
clang source1.c source2.c source3.c etc.c

For https://github.com/dulaccc/DPMeterView,
The example project is missing $(inherited) under "Other Linker Flags"
Once you add $(inherited), run pod install and it should compile afterwards.

Related

how to solve this error : "Undefined symbols for architecture arm64"

I am getting this error continue, and there is no any error in the particular class. Can anyone tell me that how can i fix this error ?
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_MYCLASS", referenced from:
objc-class-ref in MYCLASS.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Press "Cmmand+Shift+K" to clean up, and quit Xcode.
delete the cache
Run "rm -rf ~/Library/Developer/Xcode/DerivedData" in terminal
open the project and re-build it
You need to add necessary framework to your project. Check all third party party framework and search its required framework for support. For eg if you add google analytic then you need to add CoreData , Foundation etc framework. There is some framework is missing for which third party framework needs.
I think the error says you have not defined a member function of the class.
In my case I forgot to define the constructor function and got this error. It usually depends on the compiler that you are using, for some compliers this error is not seen.

Undefined symbols for architecture x86_64 when using Tesseract

I am using tesseract provided by google. After following this tutorial, i finally built finish my app. However, when i run it, i run into the problem of undefined symbols. This is the error
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_G8Tesseract", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How do i fix this issue? I tried searching online but none of the solutions worked for me. I tried reinstalling the pods and updating it. Then i faced this error
clang: error: no such file or directory: '/Users/admin/Desktop/tst/Pods/Target Support Files/Pods-tst/Pods-tst-dummy.m'
clang: error: no input files
When i tried redoing the project i get his error
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_G8Tesseract", 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)
Apparently i had to add the TesseractOCR.framework separately even after using cocoa pods and disable Bitcode. This prevented the errors.
I think you should update pod version:
sudo gem install cocoapods
After this run:
pod update --verbose
Since Tesseract requires libstdc++.6.0.9.dylib (or libstdc++.6.0.9.tbd if libstdc++.6.0.9.dylib is unavailable in your current Xcode version) and CoreImage.framework you’ll need to link both of these libraries in.
In the General tab, scroll down to Linked Frameworks and Libraries.
There should be only one file here: TesseractOCR.framework, which you just added. Click the + button underneath the list. Find both libstdc++.dylib (or libstdc++.6.0.9.tbd) and CoreImage.framework and add them to your project.

Adding Stripe Pod- linker error

The pod was installed properly. I also tried a clean/build multiple times. My header files are included in the bridging header.
My architectures include arm64 but I'm still receiving this error.
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Stripe", referenced from:
__TMaCSo6Stripe in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Actually when I ran pod install, it didn't inherit my path in
OTHER LINKER FLAGS
so it was a manual fix by adding
$(inherited)
Hope this helps someone if they encounter the same problem.
I just integrated the Stripe cocoapod yesterday and had quite a few issues myself. I'm guessing in your Stripe/Support Files in your Pods directory, you have a file called Stripe-umbrella.h.
The only luck I had integrating Stripe was importing the umbrella file in my bridging header like below (make sure to remove quotes):
#import <Stripe/Stripe-umbrella.h>
Add this, clean, build and you should have better luck.
For the record, I'm using XCode7.

cocoapods linker error when i added it to my project

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

building TestFlightSDK with cocoapods

I seem to be getting the error message while trying to compile TestFlightSDK in my app via cocoapods
Im my Podfile i have the line:
pod 'TestFlightSDK'
And the pod update works fine.
When i try and compile the app i get the message:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_TestFlight", referenced from:
objc-class-ref in OurDealAppDelegate_iPhone.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
my app is only supporting Architecture armv7 (because if i add armv7s or arm64 older libraries fail to compile - so i assume its something to do with this.
Is there any work around for this?
Okay, you need to confirm whether Cocoapods has included libTestFlight.a library in your project. Cocoapods has never added the library for me.
So, please follow the steps below:
Open the Pods-TestFlightSDK target in the Pods.xcodeproj project
Open Build Phases tab and add libTestFlight.a
libTestFlight.a can be found at [$SRCROOT]/Pods/TestFlightsSDK

Resources