Mach-O Linker Error in Xcode - objective-c

Ok so I have 2 projects. I want to import a class file from Project 1 to Project 2. When I import the class file. I get a linker error. Here's what it looks like.
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_ClassFile1", referenced from:
objc-class-ref in ClassFile2.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?

Your tags include both ios and osx. if you're building an iOS app, check your Architecture setting in your Xcode project. It shouldn't be x86_64.

Possibly, you might have forget adding target to that file. In Xcode, Select the .m file and In the 'File inspector' on the right pane check Target Membership. Ensure that the target is checked for this file.

Related

Unable to access the classes from a custom swift framwork in iOS

I have created a swift framework which contains Obj C classes, and I am trying to use it in my demo app (written in obj c) using development Pods (local cocoa pods), I could able to import the Headers, and I could able to call the methods which are in the framework, but I am getting the following error while compiling the demo app
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_ClassName", 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 resolve this? any suggestion would be appeciated
Updates: Define Module is set to YES in framework's build settings, Under Packaging

ObjC Lbrary Usage: Undefined symbols for architecture armv7

I have XCode library I wrote which I use inside Unity3D application.
The library works and now I need to make a change in the implementation, not the interface.
The problem is that in the XCode project created from Unity3D, when I use my library .a file I get this error (I've remove the specific class names).
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ABNUnityativeController", referenced from:
_OBJC_CLASS_$_ABUnityNativeController in libABSDK_Unity_NativeController_iOS.a(ABUnityNativeController.o)
"_OBJC_METACLASS_$_ABNativeController", referenced from:
_OBJC_METACLASS_$_ABUnityNativeController in libABSDK_Unity_NativeController_iOS.a(ABUnityNativeController.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm pretty sure the problem is how I compile my library.
I find that my project settings were bad.
When I choose the main project (I also have sub XCode project in it) inside Build Phases -> Link Binary With Libraries I had to add my sub-project which was listed under Workspace directory.

"_OBJC_CLASS_$_", referenced from: error in xcode 4.3.2

So today I ran into a major problem. I got a problem involving my viewcontroller on xcode 4.3.2 as seen in the attached code:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SecondViewController", referenced from:
objc-class-ref in Birdflix_ProViewController.o
"_OBJC_CLASS_$_ThirdViewController", referenced from:
objc-class-ref in Birdflix_ProViewController.o
"_OBJC_CLASS_$_FourthViewController", referenced from:
objc-class-ref in Birdflix_ProViewController.o
"_OBJC_CLASS_$_Author", referenced from:
objc-class-ref in Birdflix_ProViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I noticed that these errors only appear when I program IBActions linking my viewcontroller to additional classes. If I delete the IBActions the errors disappear. Any help is appreciated.
Thanks
Please add your SecondViewController.m or SecondViewController.mm, ThirdViewController.m/.mm, FourthViewController.m/.mm, Birdflix_ProViewController.m/.mm files to the Compile sources to build successfully.
To add files to compile source do the following
Build phase in xcode
Select Compile Sources
Press + button to add .m/.mm file
I think that you have added some other static library. And you have not linked it in your project target. Fist clean all targets and build again then check project setting bar shows simulator version properly for active build target.
Hope it will help.

Strange error when running my project

When trying to run my project I get this error and I donĀ“t know what it means :
_OBJC_CLASS_$_MyWindowController", referenced from:
objc-class-ref in AppDelegate.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What does it mean and how can I get rid of it?
Any ideas?
Select the application target, go to the Build Phases tab and make sure MyWindowController.m is in Compile Sources, otherwise add it.
Also, if you use a xib file associated with it, make sure it is in Copy Bundle Resources.
Check to see if the framework that your MyWindowController object is based on has been added to your project.
Good luck!

Xcode 4 error SDK authorize.net

When trying to compile with Xcode, I am getting the following error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AuthNet", referenced from:
objc-class-ref in ConnectionManager.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am using SDK authorize.net
please help!!
You haven't linked the library to your application. Select the project from the navigator sidebar, select your target, then go to the Build Phases section. Under Link Binary With Libraries, add the AuthNet library.
Sounds like you are not including the libraries correctly.
Make sure that you followed each of these instructions:
Set your Library Search Paths with the path that contains the "Authorize.Net SDK"
library. (ex. "$(SRCROOT)/ANMobilePaymentLib").
Set your Other Linker Flags with "-lxml2" to allow for xml parsing.
Set your Header Search Paths with the path that contains "libxml2" header
files. (ex. "/usr/include/libxml2" with recursive checked).