TouchJSON Fails on Compile (link error) - objective-c

Undefined symbols for architecture x86_64:
"_objc_unretainedPointer", referenced from:
-[CJSONScanner scanJSONStringConstant:error:] in CJSONScanner.o
-[CJSONSerializer serializeNumber:error:] in CJSONSerializer.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Hey all. Trying to use TouchJSON to do some JSON-y stuff. I followed the read me for the library to the meter I think, but every time I try to compile I get this error. I don't know much about Xcode (I've only been learning Obj-C recently) so I'm clueless about this. Any ideas?

Try to remove "Experimental" folder (and files inside, of course).
README
Be aware that the code in the Experimental subdirectory of Source is
just that and may not have been extensively tested and/or have extra
dependencies
So it could be a problem about extra dependencies (but always make sure if your project already have linked all dependency libraries/framework)

Related

iOS manually exporting library causes issues

I made a library and I want to test it in a dummy project I made. Both projects are made in Objective-C. When I build my library I get a Successful Build message and three files under the Product directory:
FooIOS.bundle
libFooIOS.a
include
I place these three files at the root level of my dummy project and when I open my myDummyProject.xcworkspace file I see them in my project hierarchy. However, when I build my project I get the following error:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_FooSelectedPageViewController", referenced from:
objc-class-ref in libFooIOS.a(FooViewController.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I did away with some of the obvious checks:
Made sure to reference my external library
I also made sure that both my library and project architectures are set as armv7 arm64
I don't know what else to do. I may be missing another configuration step or it may even be the way I declared something in my library that doesn't conform with my dummy project. Or a discrepancy between projects, perhaps? Any hints or leads would be a great help. Thanks.

_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.

How to solve "Undefined symbols for architecture x86_64:"?

I've done hours and hours of searching and still no luck (read a lot of stackoverflow as well).
I am trying to implement FDTake via Cocoapods. When I try and run it I get the following:
undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_FDTakeController", referenced from:
objc-class-ref in VendeViewController.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 know there is many similar questions around SO but all their solutions don't seem to work for me.
From the logs I can assume that you would be using a static library which is not build for simulator(architecture x86_64).
The library is only compiled for device and it needs to be complied and build for simulator also. Then the two static files (one abc.a for device and one abc.a for simulator) needs to be fat file i.e these files should be merged together using lipo command on terminal to create a fat file. Now when you use this fat file it will work both for simulator as well as device.
But the important thing is that you should have the source to compile and build the static libraries for simulator and device. After which you merge these to create a fat file which will work on all the defined architectures.
In case you are using third party static library (SDK) then you need to contact the respected party.

Undefined symbols for architecture x86_64 when trying to unit test the application

I'm getting an error in XCode when trying to run unit tests. Any ideas?
I have tried changing the Framework search paths in Build Settings to $(SDKROOT)/Developer/Library/Frameworks
$(DEVELOPER_LIBRARY_DIR)/Frameworks
But that did not change anything.
ld: warning: directory not found for option '-F/Applications/Xcode'
ld: warning: directory not found for option '-
F4.3.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/Developer/Library/Frameworks'
ld: warning: directory not found for option '-F/Applications/Xcode'
ld: warning: directory not found for option '-F4.3.2.app/Contents/Developer/Library/Frameworks'
ld: warning: ignoring file /Applications/Xcode 4.3.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks//SenTestingKit.framework/SenTestingKit, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"_STComposeString", referenced from:
-[AddressBookFrameworkSyncHelperTest testAddingAPersonToGroupsFromAVcard] in AddressBookFrameworkSyncHelperTest.o
-[SyncTesting testExample] in SyncTesting.o
"_OBJC_CLASS_$_SenTestCase", referenced from:
_OBJC_CLASS_$_AddressBookFrameworkSyncHelperTest in AddressBookFrameworkSyncHelperTest.o
_OBJC_CLASS_$_SyncTesting in SyncTesting.o
"_OBJC_CLASS_$_AddressBookFrameworkSyncHelper", referenced from:
objc-class-ref in AddressBookFrameworkSyncHelperTest.o
(maybe you meant: _OBJC_CLASS_$_AddressBookFrameworkSyncHelperTest)
"_OBJC_METACLASS_$_SenTestCase", referenced from:
_OBJC_METACLASS_$_AddressBookFrameworkSyncHelperTest in AddressBookFrameworkSyncHelperTest.o
_OBJC_METACLASS_$_SyncTesting in SyncTesting.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
These error messages show the problem:
ld: warning: directory not found for option '-F/Applications/Xcode'
ld: warning: directory not found for option '-F4.3.2.app/Contents/Developer/Library/Frameworks'
Clearly you've got "/Applications/Xcode" and "4.3.2.app/Contents/Developer/Library/Frameworks" on your frameworks paths separately, instead of "/Applications/Xcode 4.3.2.app/Contents/Developer/Library/Frameworks".
If this is something you did, you're probably missing quotes somewhere. Maybe just doing the exact same thing you tried, but with quotes around it, will work?
If it's something that Xcode is doing automatically, Apple's missing quotes somewhere, and the workaround is probably to rename your "Xcode 4.3.2.app" to something without spaces in it.
But there may be a second problem here as well:
ld: warning: ignoring file /Applications/Xcode 4.3.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks//SenTestingKit.framework/SenTestingKit, file was built for unsupported file format which is not the architecture being linked (x86_64)
In this case, the quotes are right, and it's finding the framework… but apparently you've only got the 32-bit (i386) build installed, not the 64-bit (x86_64) one that you need.
I'm also a bit curious where this came from in the first place, as when I look at the 10.6 SDK in my Xcode 4.3.2, there's no framework called SenTestingKit.framework. Which implies that you may have hacked up your Xcode install in various ways, and the right solution might be to uninstall, reinstall, and do things properly. But it's possible this is some additional install from within Xcode (or from developer.apple.com) that you've installed and I haven't.

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.