what does it means these errors in obj-c? - objective-c

This is the first error:
"_OBJC_CLASS_$_BNRHypnosisView", referenced from:
objc-class-ref in BNRHypnosisViewController.o
(maybe you meant: _OBJC_CLASS_$_BNRHypnosisViewController)
ld: symbol(s) not found for architecture x86_64
The second is:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What does these errors mean?

Did you add #implementation for the class?
Have you imported a .m file instead of a .h file?

Errors come both form the linker (the pice that combines compiled code into one file) and says that he can't find all he needs to do that. He misses the class BNRHypnosisView (especially for 64bit)
do you have an m file for it?
does it come from library? e.g. cocoaPods
is the library 64-bit compatible?
==> you need to add and m file or a library with the #implementation of the class.
A Header file doesn't REALLY add it. The header file only makes it known to others that the implementation will be there.... if you want, think of headers as roadsigns with townies and implementations as towns

Related

_OBJC_CLASS_$_KeyboardViewController", referenced from:objc-class-ref in KeyboardPreferencesController.o

I am totally stuck with an error I am getting when trying to test project on the simulator.
Error looks like:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_KeyboardViewController", referenced from:
objc-class-ref in KeyboardPreferencesController.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 building custom keyboard using keyboard extension and what I am trying to do is that in main application I am implementing settings view to modify keyboard like font change... so of course, it needs to be linked to extension header file KeyboardViewController.h
I have tried to add Other Linker Flags -> $(inherited) in both debug and release, also tried to switch Build Active Architecture Only -> YES but it also does not worked for me.
So is there any other solution for this because I can not find anything what will work for me.
Thanks in advance!
You need to compile and link the implementation file (KeyboardViewController.m?) into your target.
Use Xcode's File Inspector to make sure target membership is turned on. Look at the build phases to make sure the implementation file is included.
If those things are correct, look at the KeyboardViewController.m to make sure it actually has a #implementation section.

Trying to use Dave DeLong DDFileReader Class

I'm trying to use Dave DeLongs DDFileReader Class but I'm getting an error while building.
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_DDFileReader", referenced from:
objc-class-ref in tmnAppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The "DDFileReader.m" has a set target membership and is under build phases in the "compile sources"
I'm on 10.8.3 with XCode 4.6.2
I'm sure this is a noob error but I still would appreciate the help.
Thanks
When I look in your DDFileReader.m file that you've checked into GitHub, the entire contents is:
//DDFileReader.m
#import "DDFileReader.h"
#interface NSData (DDAdditions)
#end
You need to have the entire code snippet from the .m file copied in there.

Linker error when trying to use SmartfoxServer-framework with a Kobold-2D project

When trying to use the SmartfoxServer-framework inside a Kobold2d project we are getting the following error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CCAsyncObject", referenced from:
objc-class-ref in libcocos2d-extensions-ios.a(CCTextureCache+CCBigImageExtensions.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1
This happends due to the fact, that we have to include the -ObjC linker flag to have the categories loaded, which are defined in the SmartfoxServer-framework. I already read about the need to force-link a static library which contains categories here, but the SmartFoxServer-Framework isn't a static library.
Is there a way to force load a framework, so it includes all the categories without using the -ObjC linker flag? Or is there a convenient way to convert a framework to a static library? Any help is greatly appreciated!
Unless you are using CCBigImage, you can deselect the CCTextureCache+CCBigImageExtensions.h and .m files from the target.
Open the Kobold2D-Libraries project and browse to the group /Extensions/CCBigImage. From the menu choose View -> Utilities -> File Inspector. Select each file and uncheck the target checkbox in File Inspector. Now this particular class won't be compiled anymore and the error is gone.
The problem seems to be that this category uses a private class that's defined only in the implementation file. Unfortunately force loading the entire cocos2d-iphone-extensions project is not a solution because this brings up other errors.

Error message shows up when adding a class

I have a class called PrimeNumber that I wrote recently, which worked absolutely fine with a Foundation Tool and a Mac application. However, trying to use it with an iPhone application fails. I added the .m and the .h files to my project and imported the .h file to my ViewController.h like this:
#import "PrimeNumber.h"
After trying to use a method declared in my PrimeNumber class and run my application, Xcode showed me two errors:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_PrimeNumber", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The PrimeNumber.h and PrimeNumber.m files are not red in the Project navigator. Product > Clean doesn't work either. Also, because my classes aren't declared in a framework, I do not think something like that can be the problem.
Can anyone tell me what I'm doing wrong? Thanks!
Edit: changing the class name to PrimeNumbers, then creating a new Objective-C class called PrimeNumber and copy-and-pasting the complete contents of .h and .m files of the PrimeNumbers class into the .h and .m files of the PrimeNumber class worked for me. Weird, but it worked. :)
You have to add it to the "Compile Sources" Build Phase as well.
Project -> Targets -> [Your Target] -> Build Phases -> Compile Sources (just drag PrimeNumber.m in there)

RKJSONParserJSONKit not found

I'm trying to use JSON parsing from RestKit, but I'm receiving
the following compile time error:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_RKJSONParserJSONKit", referenced from:
objc-class-ref in FloorMapLoaderViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
RestKit works ok, this being the only error I've seen so far.
This is my import line:
#import <RestKit/Support/JSON/JSONKit/RKJSONParserJSONKit.h>
edit:
oddly, it fails to compile only if I try to create a parser like so:
RKJSONParserJSONKit *parser = [RKJSONParserJSONKit new];
Commenting out this line allows for compilation, but I do need to instance a parser.
How can I fix this error?
Thank you.
Importing means that your source code can see the API, so the IDE knows how to auto-complete and so that the compiler knows how to generate the right object code.
You have a linker error. Once your own code is compiled, it has to all be bundled together with all the code it is dependent on (not counting dynamically linked system libraries). Your linker is telling you that after bundled everything it can find together, not all of it is there.
What you need to do is go to the target you are building, select the Build Phases tab, and add the necessary library to the "Link Binary With Libraries" section.