Xcode初學者的問題:這是我第一次使用Xcode 4.6.3。我正在嘗試編寫一個非常簡單的控制臺程序,該程序搜索配對的BT設備并將其打印到NSLog。生成時出現(xiàn)以下錯誤: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)我瘋狂地搜尋。常見的問題應該是對文件的引用,該文件僅導入了頭文件,而鏈接器未找到任何實現(xiàn)(* .m文件)。但是,IOBluetooth庫是類似于Foundation Framework的標準框架。我在上述聲明中缺少什么?我也嘗試過為32位計算機構建它(構建再次失敗)。顯然,這是一個鏈接器錯誤,但與它的關系不知道,除了在x86和x64體系結構上查找IOBluetoothDevice的實現(xiàn)存在問題之外,而頭文件來自一個包含在標準中的Framework(稱為IO藍牙?供您參考,我的主要代碼“ main.m”為:#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;}感謝您的幫助或指向正確方向的指示。
Xcode構建失敗“體系結構x86_64的未定義符號”
阿波羅的戰(zhàn)車
2019-10-28 11:08:04
