objective c - Xcode build failure "Undefined symbols for architecture x86_64" -
an xcode beginner's question:
it first experience xcode 4.6.3.
i trying write simple console program, searches paired bt devices , prints them nslog.
it builds following error:
undefined symbols architecture x86_64: "_objc_class_$_iobluetoothdevice", referenced from: objc-class-ref in main.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation)
i searched crazy. common problem should reference file, of header files imported , no implementation (*.m-file) found linker. iobluetooth library however, standard framework foundation framework.
what missing in above statement?
i have tried building 32-bit machine (build fails again). linker error, have no idea, relates, except there issue finding implementation iobluetoothdevice, on both x86 , x64 architecture, while header files standard included framework, called iobluetooth?
for information main code "main.m" being:
#import <foundation/foundation.h> #import <iobluetooth/objc/iobluetoothdevice.h> // note import bluetooth #import <iobluetooth/objc/iobluetoothdeviceinquiry.h> // note import bluetooth int main(int argc, const char * argv[]) { @autoreleasepool { iobluetoothdevice *currentdevice; nsarray *devices = [ iobluetoothdevice paireddevices]; (id currentdevice in devices){ nslog(@"%i : %@",[ currentdevice classofdevice ], [ currentdevice name ]); } } return 0; }
thanks or pointers right direction.
it looks missing including iobluetooth.framework in project. can add by:
-clicking on project in upper left of left pane (the blue icon).
-in middle pane, click on build phases tab.
-under "link binary libraries", click on plus button.
-find iobluetooth.framework list , hit add.
this make sure iobluetooth.framework definitions found linker. can see framework member of target clicking on framework in left pane , seeing framework's target membership in right pane (note i've moved framework under frameworks group organization purposes):
Comments
Post a Comment