I'm using a slightly outdated version of Xcode (4.2.1, with Apple clang version 3.0), which might be a problem, but.. this should work regardless:
I create a new Quicklook plugin project ("File > New > New Project", then "System Plugin > Quick Look Plug-in")
Then I rename GeneratePreviewForURL.c to GeneratePreviewForURL.m (as mentioned in the Apple docs)
If I try and use any Objective-C code in the file, I get errors. For example if I add the following to the GeneratePreviewForURL method:
#include <Foundation/Foundation.h> // at start of file
NSMutableDictionary *blah;
[blah setValue:#"valuething" forKey:#"keything"];
I get the following linker error:
Undefined symbols for architecture x86_64:
"_objc_msgSend", referenced from:
_GeneratePreviewForURL in GeneratePreviewForURL.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 slightly trimmed/reformmated linker command causing the problem is:
cd ~/QuicklookExample
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Developer/usr/bin/clang
-arch x86_64 -bundle
-isysroot /Developer/SDKs/MacOSX10.7.sdk
-L/snip -F/snip -filelist /snip/QuicklookExample.LinkFileList
-mmacosx-version-min=10.7
-framework QuickLook
-framework ApplicationServices
-framework CoreServices
-framework CoreFoundation
-o /snip/QuicklookExample
You have to add at least Foundation framework to the linked libraries.
Note that what's missing here is libobjc which should be linked directly by the fact clang should understand your code is actually Objective-C.
Related
I am trying to compile a project using the ASIHTTPREQUEST library.
I followed the directions and linked to all the necessary libraries, and I get no errors that are not compile errors... I am allowed to try to compile the project.
The problems only arise when I try to use this code in my .m
NSURL *colorURL = [NSURL URLWithString:#"http://www.colourlovers.com/api/colors?format=json"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:colorURL];
[request setDelegate:self];
[request startAsynchronous];
from this tutorial:
http://ios-blog.co.uk/tutorials/parsing-json-on-ios-with-asihttprequest-and-sbjson/
Ld /Users/johndoe/Library/Developer/Xcode/DerivedData/round5-bdubuaqrmfeeujdoabfnpkzsctpa/Build/Products/Debug-iphonesimulator/round5.app/round5 normal i386
cd /Users/johndoe/Documents/apps/iphone/corelocationtest/round5
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/johndoe/Library/Developer/Xcode/DerivedData/round5-bdubuaqrmfeeujdoabfnpkzsctpa/Build/Products/Debug-iphonesimulator -F/Users/johndoe/Library/Developer/Xcode/DerivedData/round5-bdubuaqrmfeeujdoabfnpkzsctpa/Build/Products/Debug-iphonesimulator -filelist /Users/johndoe/Library/Developer/Xcode/DerivedData/round5-bdubuaqrmfeeujdoabfnpkzsctpa/Build/Intermediates/round5.build/Debug-iphonesimulator/round5.build/Objects-normal/i386/round5.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -lz -framework CFNetwork -framework SystemConfiguration -framework MobileCoreServices -framework CoreLocation -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/johndoe/Library/Developer/Xcode/DerivedData/round5-bdubuaqrmfeeujdoabfnpkzsctpa/Build/Products/Debug-iphonesimulator/round5.app/round5
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ASIHTTPRequest", referenced from:
objc-class-ref in round5ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I don't understand what this error means:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ASIHTTPRequest", referenced from:
objc-class-ref in round5ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Really lost... please help!!
PS: I looked at some other threads on stack overflow but they don't reference to the same error.
never mind!!!
duplicate:
Error with iOS 5.1 when i use ASIHTTPRequest and SBJSON
"I would take a look at the Build Phases section in your Target. Under "Compile Sources", make sure you see the .m files for ASIHTTPRequest and for SBJson. Sometimes when you drag external classes into a project, even if you check the box to copy the files into your project, they don't make it into these compile sources. When you drag a file into Xcode, there is a check box to add the file to the target. If this isn't checked, the file won't make it into the Compile Sources. Delete the files and re-add them, ensuring this file is checked (or you can add the .m files manually if you'd like)."
by jmstone
hy all,
I am building an application to create a simple tableview, with a search bar on top to search between the elements of the table.
I have followed a tutorial and no coding errors were found, but when building, it always fails showing the following message:
Ld /Users/gouyoun/Library/Developer/Xcode/DerivedData/ERCDictionnary-atjolczeormaykcscwvnhlxdcnvk/Build/Products/Debug-iphonesimulator/ERCDictionnary.app/ERCDictionnary normal i386
cd /Users/gouyoun/Desktop/ERCDictionnary/ERCDictionnary
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Volumes/Xcode/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Volumes/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/gouyoun/Library/Developer/Xcode/DerivedData/ERCDictionnary-atjolczeormaykcscwvnhlxdcnvk/Build/Products/Debug-iphonesimulator -F/Users/gouyoun/Library/Developer/Xcode/DerivedData/ERCDictionnary-atjolczeormaykcscwvnhlxdcnvk/Build/Products/Debug-iphonesimulator -filelist /Users/gouyoun/Library/Developer/Xcode/DerivedData/ERCDictionnary-atjolczeormaykcscwvnhlxdcnvk/Build/Intermediates/ERCDictionnary.build/Debug-iphonesimulator/ERCDictionnary.build/Objects-normal/i386/ERCDictionnary.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/gouyoun/Library/Developer/Xcode/DerivedData/ERCDictionnary-atjolczeormaykcscwvnhlxdcnvk/Build/Products/Debug-iphonesimulator/ERCDictionnary.app/ERCDictionnary
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_OverlayViewController", referenced from:
objc-class-ref in tableView.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"_OBJC_CLASS_$_OverlayViewController", referenced from:
objc-class-ref in tableView.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm a newb in OBjective C, any ideas?
Your tableView class refers to a class called OverlayViewController which is not in your project.
Its done, it only needed to remove the files and re-add them later, it worked like a charm
I've had the exact same error. It occured because I had 2 xCode Projects open, an Dragged & Dropped a class from one project to the other one. I checked "Copy to project" and the files where in the new projects folder. But it crashed every time.
I deleted the classes and IMPORTED them into the project and then it worked... So be careful when using Drag'n'Drop!
I have no experience at all at objective-c, only now started.
A developer I work with had to go abroad for a few days, and by mistake left an error in the code, and now I cannot compile an Iphone application to finish it...
I got some information from him by mail, and he told me that he left a library that is called dialog and that I need to remove it to make it work...
The thing is that I have no experience in objective-c and Xcode... i'm the web developer :)
i tried to run the project, and got this error:
Build target mormar
Ld
/Users/yanivshimony/Library/Developer/Xcode/DerivedData/mormar-cxfykryhzfovlbgtsjfowgleiyxu/Build/Products/Debug-iphonesimulator/mormar.app/mormar
normal i386
cd /Users/yanivshimony/Desktop/mormar
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk
-L/Users/yanivshimony/Library/Developer/Xcode/DerivedData/mormar-cxfykryhzfovlbgtsjfowgleiyxu/Build/Products/Debug-iphonesimulator
-F/Users/yanivshimony/Library/Developer/Xcode/DerivedData/mormar-cxfykryhzfovlbgtsjfowgleiyxu/Build/Products/Debug-iphonesimulator
-filelist /Users/yanivshimony/Library/Developer/Xcode/DerivedData/mormar-cxfykryhzfovlbgtsjfowgleiyxu/Build/Intermediates/mormar.build/Debug-iphonesimulator/mormar.build/Objects-normal/i386/mormar.LinkFileList
-mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 -framework UIKit -framework Foundation -framework CoreGraphics -o
/Users/yanivshimony/Library/Developer/Xcode/DerivedData/mormar-cxfykryhzfovlbgtsjfowgleiyxu/Build/Products/Debug-iphonesimulator/mormar.app/mormar
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CATransition", referenced from:
objc-class-ref in LoadingView.o "_kCATransitionFade", referenced from:
+[LoadingView loadingViewInView:] in LoadingView.o
-[LoadingView removeView] in LoadingView.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with
exit code 1 (use -v to see invocation)
after googling this for a while, I still have no idea how to solve this...
I would greatly appreciate any help,
thanks!
You need to link against QuartzCore.
Click on your project name in the Xcode sidebar. Then click on your target, and in the Summary tab find the list of linked frameworks and libraries. Click the plus button below this list, and add QuartzCore.
You need QuartzCore framework. Add it to your project (through project setting's "Link binary" build phase). Add the #import <QuartzCore/QuartzCore.h> to project's prefix header (usually Prefix.pch or {ProjectName}-Prefix.pch). This should solve the problem without removal of this library.
This is driving me crazy, when i try to compile on the simulator, everything is ok, but on the device i got this error:
ld: library not found for -lz
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
Please help me understand the source of the problem:
Ld /Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Products/Debug-iphoneos/Fontenay-sous-Bois.app/Fontenay-sous-Bois normal armv7
cd /Users/ZConsulting/Desktop/Fontenay-sous-Bois
setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Products
/Debug-iphoneos -F/Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Products/Debug-iphoneos -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
/iPhoneOS5.0.sdk/Developer/Library/Frameworks -filelist /Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Intermediates/Fontenay-sous-Bois.build/Debug-iphoneos/Fontenay-sous-Bois.build/Objects-normal/armv7/Fontenay-sous-Bois.LinkFileList -dead_strip -fobjc-arc -miphoneos-version-min=5.0 -framework SenTestingKit -lz -lz.1.1.3 -framework MobileCoreServices
-framework SystemConfiguration -framework CFNetwork -framework CoreLocation -framework MapKit -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Products/Debug-iphoneos/Fontenay-sous-Bois.app/Fontenay-sous-Bois
EDIT:
I did import the libz.1.1.3.dylib framework:
The only libz that i got in the Linked frameworks is the libz.1.1.3.dylib
You did specify the library libz.dylib in the Linked frameworks and Libraries item rather than the direct reference to libz.1.1.3 - in general you should use the most generic version of a library for compilation rather than a more specific one
Secondly, make sure that the libz.dylib is present under the iOS SDK - if it's missing, then it may be a mis-installed SDK (reinstall should fix that).
i.e.
find /Developer/Platforms -name libz.dylib
should result in a non-empty output for a libz.dylib under iPhoneOS5.0.sdk
Also see the answer to iPhone - Linker Error in Xcode 4.2 Preview, which is a similar issue to this.
i got the same error with a different library:
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
to resolve this, under search paths -> user header search paths -> release i put:
"$(BUILD_ROOT)/../IntermediateBuildFilesPath/UninstalledProducts/include"
keep in mind that I get this bug only when I archive, and my archive is a based off my release scheme..
update:
I got the same problem (on a different occasion/project) for the lpods Library (ie cocoapods).. the way i figured out to solve this is by realizing that the build worked fine on my development scheme but not my debug scheme. basically the development scheme had no for build active architectures only whereas debug had yes. I simply changed debug to no in all the targets under cocoapods
I am trying to Fetch Videos from YouTube Channel on Cocoa Application. For that First added GData Framework to my project, and import #import "GData/GData.h". Then their is no error . But if i am importing #import "GData/GDataServiceGoogleYouTube.h"
and write some code related to GDataServiceGoogleYouTube
GDataServiceGoogleYouTube *service=[[GDataServiceGoogleYouTube alloc]init];
getting Compiler eror:
Ld /Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth/Build/Products/Debug/YouTube.app/Contents/MacOS/YouTube normal x86_64
cd /Users/Rasheed/Desktop/MULTIPLESOCKET/YouTube
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Developer/usr/bin/clang -arch x86_64 -isysroot
/Developer/SDKs/MacOSX10.6.sdk -L/Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth/Build/Products/Debug
-F/Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth/Build/Products/Debug -filelist
/Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth
/Build/Intermediates/YouTube.build/Debug/YouTube.build/Objects-normal/x86_64/YouTube.LinkFileList -mmacosx-version-min=10.6 -ObjC
-lxml2 -all_load -framework Cocoa -o /Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth/Build
/Products/Debug/YouTube.app/Contents/MacOS/YouTube
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_GDataServiceGoogleYouTube", referenced from:
objc-class-ref in YouTubeAppDelegate.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 can i Fix This error?
If you built a GData static library, make sure the library is listed in the “Link Binary With Libraries” section under the “Build Phases” tab for your target.
If you dragged all of the GData source files into your project, make sure they are all listed in the “Compile Sources” section under the “Build Phases” tab for your target.
You might find this blog post helpful: http://hoishing.wordpress.com/2011/08/23/gdata-objective-c-client-setup-in-xcode-4/