I'm trying to use iCarousel (https://github.com/nicklockwood/iCarousel) and have added iCarousel.h & iCarousel.m to my project (using Xcode 4.3.1).
But I'm getting a linker error when trying to allocation an instance of iCarousel (iCarousel inherits from UIView):
self.carousel = [[iCarousel alloc]initWithFrame:self.view.bounds];
The linker error in full is:
Ld "/Users/Me/Library/Developer/Xcode/DerivedData/IMS-eyffphshuxtblseccxpfluamxudo/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp" normal i386
cd /Users/Me/Desktop/IMS/3.2
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/Me/Library/Developer/Xcode/DerivedData/IMS-eyffphshuxtblseccxpfluamxudo/Build/Products/Debug-iphonesimulator -F/Users/Me/Library/Developer/Xcode/DerivedData/IMS-eyffphshuxtblseccxpfluamxudo/Build/Products/Debug-iphonesimulator -filelist "/Users/Me/Library/Developer/Xcode/DerivedData/IMS-eyffphshuxtblseccxpfluamxudo/Build/Intermediates/IMS.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp.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 AssetsLibrary -framework SystemConfiguration -framework MessageUI -framework EventKit -framework MapKit -framework QuartzCore -framework AddressBook -framework UIKit -framework Foundation -framework CoreGraphics -o "/Users/Me/Library/Developer/Xcode/DerivedData/IMS-eyffphshuxtblseccxpfluamxudo/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp"
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_iCarousel", referenced from:
objc-class-ref in IMSCarouselViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
There are example projects that demonstrate the use of iCarousel and these compile fine. I presume there must be some build setting differences between my project and the example projects, but I've no idea what they might be, nor how to find out. Are there any tricks for deciphering the linker message to find out what the problem is?
(I'm using the same frameworks/libraries as in the example project)
TIA
Even though you have the .h & .m file added to your project, it sounds like they're not being compiled. Select the iCarousel.m file in the File Inspector (on the left side of your project) and then look at the "Target Membership" setting in the File Inspector.
It'd look something like this (only "iCarousel.m" would be selected and not "AppDelegate.m"):

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With