I am getting the following error when compiling my code
"_CGRectZero", referenced from:
_CGRectZero$non_lazy_ptr in RootViewController.o
_CGRectZero$non_lazy_ptr in SecondViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Build failed (1 error)
could someone tell me a solution to solve this?
Sounds like your project is missing a framework.
Right-click on the Frameworks folder in your project's Groups & Files column, then select Add > Existing Frameworks...
Choose CoreGraphics.framework from the frameworks list.
Once you rebuild, this error should go away (unless it is something else).
Related
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 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
From what I have read this is supposed to be when the linker (not exactly sure how that works) can't find a symbol. the symbol in question is: SCNetworkReachabilityCreateWithAddress as can be seen from the full error message below.
the thing is that the correct
framework is added to my target.
xcode recognises the symbol OK, i.e.
there is no error message in the .m
file.
the .m file is added to the correct
target so I'm not at all sure what to
do.
Any ideas please?
"SCNetworkReachabilityCreateWithAddress", referenced from:
-[AppWelcomeVC viewDidLoad] in AppWelcomeVC.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Do you have #import <Availability.h> in your AppWelcomeVC class header, or added to your precompiled header (MyApp_Prefix.pch)?
What frameworks do you have in your project?
In the past when I've had this error removing the framework and readding it fixed the problem.
Permissions problems with the framework file itself can also cause this error.
When I add libiphone-exif.a to snapandrun in objectiveflickr I get this error:
".objc_class_name_EXFJpeg", referenced from:
literal-pointer#__OBJC#__cls_refs#EXFJpeg in SnapAndRunViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I do not know what this means, I follow the guide to add it, add all of the .h files and the libiphone-exif.a
Is there something special I have to do?
It sounds like you didn't add the library properly. It is a static library, not an Objective C or data file, so simply adding it to the project isn't enough. All that will happen is that it gets copied into the application bundle, when it needs to be statically linked into the executable. You have to open your targets and add the .a file under "Link Binary With Libraries".
I downloaded the source from the svn project from google and drag and drop into my project.
Clicking the target and marking the static lib as "weak" type instead of "required" made no difference.
I'm trying to use SHFHKeychainUtils in my project, but I keep getting the following error when I build:
".objc_class_name_SFHFKeychainUtils", referenced from:
literal-pointer#__OBJC#__cls_refs#SFHFKeychainUtils in ResultsViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I added Security.framework via Target > Get Info > General
Any help would be greatly appreciated, thanks.
It's because you haven't added the files SFHFKeychainUtils (.h and .m) to your project, or that they aren't included for your target (check this by making sure the check-box at the right of the line for this file is checked).