Undefined symbols for architecture x86_64
来源:互联网 发布:html链接数据库 编辑:程序博客网 时间:2024/06/05 20:13
A Xcode beginners' question:
It is my first experience with Xcode 4.6.3.
I am trying to write a very simple console program that searches for paired BT devices and print them to a NSLog.
The build with the error:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_IOBluetoothDevice", referenced from: objc-class-ref in main.old: symbol(s) not found for architecture x86_64clang: error: linker command failed with exit code 1 (use -v to see invocation)
I searched like crazy. The common problem should be a reference to a file of which only the header files are imported and no implementation (*.m-file) is found by the linker. The IOBluetooth library is however a standard Framework like the Foundation Framework.
What am I missing in my above statement?
I also have tried building it for a 32-bit machine (build fails again). It is clearly a linker error, however I hove no idea to what is relates except that there is an issue with finding the implementation for IOBluetoothDevice on both x86 and x64 architecture while the header files a from a standard included Framework called IOBluetooth?
For your information my main code "main.m" being
#import <Foundation/Foundation.h>#import <IOBluetooth/objc/IOBluetoothDevice.h> // Note the import for bluetooth#import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h> // Note the import for bluetoothint main(int argc, const char * argv[]){ @autoreleasepool { IOBluetoothDevice *currentDevice; NSArray *devices = [ IOBluetoothDevice pairedDevices]; for (id currentDevice in devices){ NSLog(@"%i : %@",[ currentDevice classOfDevice ], [ currentDevice name ]); } } return 0;}
Thanks for any help of pointers into the right direction.
解决方案:
It looks like you are missing including the IOBluetooth.framework in your project. You can add it by:
-Clicking on your project in the upper left of the left pane (the blue icon).
-In the middle pane, click on the Build Phases tab.
-Under "Link Binary With Libraries", click on the plus button.
-Find the IOBluetooth.framework from the list and hit Add.
This will make sure that the IOBluetooth.framework definitions are found by the linker. You can see that the framework is a member of your target by clicking on the framework in the left pane and seeing the framework's target membership in the right pane (note I've moved the framework under the Frameworks group for organization purposes):
- Undefined symbols for architecture x86_64:
- Undefined symbols for architecture x86_64
- Undefined symbols for architecture x86_64
- Undefined symbols for architecture x86_64:
- Undefined symbols for architecture x86_64
- Undefined symbols for architecture x86_64
- Undefined symbols for architecture x86_64:
- Undefined symbols for architecture x86_64:
- Undefined symbols for architecture x86_64
- Undefined symbols for architecture x86_64:
- Undefined symbols for architecture x86_64
- undefined symbols for architecture x86_64
- Undefined symbols for architecture x86_64
- Undefined symbols for architecture x86_64
- Undefined symbols for architecture x86_64
- Undefined symbols for architecture x86_64:
- Undefined symbols for architecture x86_64
- Undefined symbols for architecture x86_64
- 笔试题总结归纳之商汤科技(sensetime)——计算视觉研究院
- 高速CAN、低速CAN、单线CAN 基础知识
- 面向对象的5个基本设计原则:
- 关于“Unable to execute dex: Cannot merge new index 65576 into a non-jumbo instruction!”
- 苹果发布时的一些问题记录
- Undefined symbols for architecture x86_64
- MyEclipse Web 项目的图标和右键New菜单
- rvm 卸载
- 上传图片预览JS脚本 Input file图片预览的实现示例
- 图像的影像地图超链接,<map>标签浅谈
- 高级学员:信息系统项目管理英文词汇汇总
- 黑马程序员---java基础---运算符、键盘录入、流程控制语句
- 史上最全的互联网专业词语汇总
- Xcode7链接错误 normal arm64 bitcode enabled