I have added the SystemConfiguration framework. I am deploying against targets from 3.2 and higher. Have I forgotten to add something?
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Reachability", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Okay, the clues are all in the error report you have posted.
While linking (the message is from the linker ld) which occurs after compilation of all the symbols across your project, the message is saying
"In AppDelegate, you have referenced a class object called Reachability"
"_OBJC_CLASS_$_Reachability"
and as far as the linker is concerned Reachability is undefined.
So, check that Reachability is being compiled in your project. The are a couple of ways to do this. Perhaps the most clear way is to
1 select the project file in the navigation pane
2 select the target
3 select Build Phases
4 Expand the Compile Sources section
*Now check the list of sources that will be compiled for your missing class, in your case Reachability.m
If it is missing, use the + button to add the file to the target.
Another way is to
1 select the file you think is not being compiled
2 open the utilities panel
3 select the file inspector tab
There will be a checkbox for each target in your project and you can easily see if your .m file is being compiled for each/all targets or not.
You might have forgotten to include the Reachability classes in your project!
I had a similar problem when I upgraded to the newest version of Mixpanel. The error read:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CTTelephonyNetworkInfo", referenced from:
objc-class-ref in Mixpanel.o
You can follow Damo's solution until the last step, and then instead of expanding the Compile Sources section, you have to expand the Link Binary With Libraries section instead, and add the CoreTelephony.framework source which contains CTTelephonyNetworkInfo.
You can read more about the CTTelephonyNetworkInfo class reference on Apple's official website here: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Reference/CTTelephonyNetworkInfo/Reference/Reference.html
Related
I downloaded a collection of private libraries from this link. When I click download I get all frameworks. So these are only header files not the .framework files that are available in Xcode. So I linked them by the usual method of going to build phases, in it I go to link binary with libraries click on + and choose the header files from a framework (preferences framework in my case). After these files are added to my project I try to make an object from one of the libraries and try to call their instance methods. When I try to execute this program I get this error. I get this whether I run it on the device or simulator.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_DevicePINController", referenced from:
objc-class-ref in UAViewController.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1
(use -v to see invocation)
DevicePinController is a part of a private framework preferences.h.I am trying to make an object of it UA
EDIT: I tried using other framework headers such as bluetooth and I get this error in all.
EDIT: I tried adding the entire framework to the project instead of adding individual header files.Now the error is
d: framework not found BluetoothManager
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You'll need to actually build the framework. You can't just link against a header file; that doesn't make sense.
Try adding all the .m files in the Preferences folder as Compile Sources, and remove the header file from Link Binary with Libraries.
Added: I realize now this answer is incorrect. The files OP is trying to use are not a library, but header files from Apple's private frameworks. Here's a related answer: https://stackoverflow.com/a/13388225/893113
I made a new xcdatamodeld with 2 entities
stage, this one has a relationship many to level
level, this one has many attributes and one relationship with stage
but when I create NSManagedObject subclass from that xcdatamodeld, and build my project.. 3 errors are shown in the log
like this:
Undefined symbols for architecture i386:
"_OBJC_METACLASS_$_NSManagedObject", referenced from:
_OBJC_METACLASS_$_Stage in Stage.o
_OBJC_METACLASS_$_Level in Level.o
"_OBJC_CLASS_$_NSManagedObject", referenced from:
_OBJC_CLASS_$_Stage in Stage.o
_OBJC_CLASS_$_Level in Level.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
anyone has had this trouble too?
How can I fix this error?
I am newbie at xcode and IOS programmer, thank you in advance ^^
It seems you haven't added CoreData.framework in your project. For this - Select Target Go to Build Phases > Link Binary With Libraries then Click on '+' button (At below left corner), Then select the CoreData.framework then click on ADD button.
I'm getting the following error only when I try to build the unit tests of an iPhone static library:
Undefined symbols for architecture i386:
"std::terminate()", referenced from:
-[ZipArchive dealloc] in libMyProject.a(ZipArchive.o)
"___gxx_personality_v0", referenced from:
Dwarf Exception Unwind Info (__eh_frame) in libMyProject.a(ZipArchive.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Building the original project works fine.
What can I be missing?
It should be noted that ZipArchive is a .mm file that references the libz.dylib framework, which is referenced both in the original project and in the test project.
Additionally, the usual Build Settings suspects have the following values:
Framework Search Paths: "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"
Other Linker Flags: -all_load -lxml2 - ObjC
Header Search Paths: /usr/include/libxml2
I found the solution in this post.
For some reason that eludes me, the compiler needed the ZipArchive.mm file to be renamed to .m when the static library is used in another project (the test project, in this case).
This typically occurs for one of two reasons:
You copied a framework or system header directly to your project folder instead of adding it with a reference through XCode
You've installed multiple SDKs, and the wrong framework or header is being referenced. Most frameworks aren't "Developer" frameworks. SenTestingKit.framework is an example of a developer framework, UIKit.framework isn't. Oddly, there are two different places that Developer Frameworks exist. In the /Developers/~ folder in XCode, and also in the SDK Developers folder. The default behavior is to reference the framework in XCode's developer folder. To override this, enter "$(SDKROOT)/Developer/Library/Frameworks" in "Framework Search Paths". Or in the case of an imported header or library, go the corresponding field and add "$(SDKROOT)/..."
Make sure your search paths are the same correct for all Targets:
If you are using multiple SDKs, the wrong version of the Developer Frameworks could get added (like SenTestingKit). Manually enter the the correct one under Framework Search Paths with
$(SDKROOT)/Developer/Library/Frameworks
I am trying to set up application tests for my iOS application. I am using the following article as the basis of what I am doing:
http://cocoawithlove.com/2009/12/sample-iphone-application-with-complete.html
So I can created the additional targets that I need. I now have 3 targets:
-The original target
-The tests target
-The duplicate target
I have added the original target as a target dependency to my test target. I have then added the test target as a target dependency on my duplicate target.
However, whenever I try to reference any of my classes in my test cases I get:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_MyClass", referenced from:
objc-class-ref in MyApplicationTests.o
"_OBJC_CLASS_$_AnotherClass", referenced from:
objc-class-ref in MyApplicationTests.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is there another location which I need to set up some sort of dependency to tell my Tests target that it is dependant on the original target?
Cheers
So I found the solution to this issue at:
http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/
You need to do the following to avoid this issue:
Go back to your app target (not the test target), set the Symbols Hidden by Default build setting to NO
Now there is no need to add any source files to the Compile Source for the test target as long as the original target is set as a dependency.
You have to include the .m file for any of your classes that you reference from your test code in the list of compiled sources for your test target. From the error message you provided, that sounds like your problem. In XCode 4.2 you can add a compile source to a target by selecting your project in the project navigator, then selecting your test target, the Build Phases tab, and expanding the Compile Sources section. Click the "+" below the Compile Sources section and then select your class' .m file.
I just marked all of my CocoaAsyncSocket code as non-ARC code, and it's given me these 3 errors:
Undefined symbols for architecture armv7:
"_kCFStreamNetworkServiceTypeVoIP", referenced from:
-[GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GCDAsyncSocket.o
"_kCFStreamNetworkServiceType", referenced from:
-[GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GCDAsyncSocket.o
"_kCFStreamPropertySSLSettings", referenced from:
-[GCDAsyncSocket maybeStartTLS] in GCDAsyncSocket.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does anybody know what this means and how to fix it?
I think I found the solution to this, by looking in the code comments, but I now see that it's also what Mark Adams suggested above. I had the errors until I added the CFNetwork.framework under Targets->Build Phases->Link Binary With Libraries->Select CFNetwork.framework
It means that some code you are compiling is referencing the constants "kCFStreamNetworkServiceTypeVoIP", "kCFStreamNetworkServiceType", and "kCFStreamPropertySSLSettings", but that those constants weren't found when it tried to link your code with the libraries it uses.
Unfortunately there's a bunch of reasons this could be:
You could have misspelled them
They could be #ifdef'd out for that architecture
You might not be linking the correct librar(y, ies)
They could be marked as having 'hidden' visibility so that they can only be used in the declaring library
Probably other reasons
You can use 'nm' to poke at the exported symbols from the binary of a library, and 'otool -L' to check which libraries your binary is linking.
I had this same error when integrating LineaPro API into an app.
The fix i implemented was adding ExternalAccessory.framework to General -> Linked Framework and Libraries.
I already had CFNetwork.framework included.