集成百度地图SDK-Undefined symbols for architecture x86_64

集成百度地图SDK,按照文档设置之后,运行报错。

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_NSMutableParagraphStyle", referenced from:
      objc-class-ref in BaiduMapAPI_Base(VBGL.o)
  "_UIGraphicsPushContext", referenced from:
      _baidu_vi::vi_map::GenTextImage(unsigned short*, unsigned int, unsigned int, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned long, unsigned long, unsigned long, unsigned int, int, _baidu_vi::vi_map::TextAlignedType) in BaiduMapAPI_Base(VBGL.o)
  "_NSForegroundColorAttributeName", referenced from:
      _baidu_vi::vi_map::GenTextImage(unsigned short*, unsigned int, unsigned int, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned long, unsigned long, unsigned long, unsigned int, int, _baidu_vi::vi_map::TextAlignedType) in BaiduMapAPI_Base(VBGL.o)
  "_NSStrokeColorAttributeName", referenced from:
      _baidu_vi::vi_map::GenTextImage(unsigned short*, unsigned int, unsigned int, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned long, unsigned long, unsigned long, unsigned int, int, _baidu_vi::vi_map::TextAlignedType) in BaiduMapAPI_Base(VBGL.o)
  "_NSStrokeWidthAttributeName", referenced from:
      _baidu_vi::vi_map::GenTextImage(unsigned short*, unsigned int, unsigned int, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned long, unsigned long, unsigned long, unsigned int, int, _baidu_vi::vi_map::TextAlignedType) in BaiduMapAPI_Base(VBGL.o)
  "_OBJC_CLASS_$_UIButton", referenced from:
      objc-class-ref in BaiduMapAPI_Map(BMKActionPaopaoView.o)
      objc-class-ref in BaiduMapAPI_Base(StretchImageUtil.o)
      objc-class-ref in BaiduMapAPI_Base(BMLogService.o)
  "_OBJC_CLASS_$_UITapGestureRecognizer", referenced from:
      objc-class-ref in BaiduMapAPI_Map(BMKAnnotationView.o)
  "_UIGraphicsBeginImageContextWithOptions", referenced from:
      -[BMKMapView takeSnapshot:] in BaiduMapAPI_Map(BMKMapView.o)
  "_UIGraphicsGetImageFromCurrentImageContext", referenced from:
      -[BMKMapView takeSnapshot:] in BaiduMapAPI_Map(BMKMapView.o)
      _baidu_vi::SaveBufferBmp2Png(char*, int, int, int, _baidu_vi::CVString&) in BaiduMapAPI_Base(VOSPng.o)
  "_UIApplicationWillResignActiveNotification", referenced from:
      -[BMKMapView registerNotification] in BaiduMapAPI_Map(BMKMapView.o)
      -[BMKMapView unRegisterNotification] in BaiduMapAPI_Map(BMKMapView.o)
  "_UIGraphicsBeginImageContext", referenced from:
      _baidu_vi::SaveBufferBmp2Png(char*, int, int, int, _baidu_vi::CVString&) in BaiduMapAPI_Base(VOSPng.o)
  "_UIGraphicsPopContext", referenced from:
      _baidu_vi::vi_map::GenTextImage(unsigned short*, unsigned int, unsigned int, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned long, unsigned long, unsigned long, unsigned int, int, _baidu_vi::vi_map::TextAlignedType) in BaiduMapAPI_Base(VBGL.o)
  "_OBJC_METACLASS_$_UIControl", referenced from:
      _OBJC_METACLASS_$_PaopaoButton in BaiduMapAPI_Map(PaopaoBaseView.o)
  "_UIEdgeInsetsZero", referenced from:
      -[BMKMapView initSubView] in BaiduMapAPI_Map(BMKMapView.o)
  "_OBJC_METACLASS_$_UIView", referenced from:
      _OBJC_METACLASS_$_BaseMapScaleView in BaiduMapAPI_Map(BaseMapScaleView.o)
      _OBJC_METACLASS_$_BMKOverlayView in BaiduMapAPI_Map(BMKOverlayView.o)
      _OBJC_METACLASS_$_CompassView in BaiduMapAPI_Map(CompassView.o)
      _OBJC_METACLASS_$__BMK_BaiduMap_EAGLView in BaiduMapAPI_Map(EAGLView.o)
      _OBJC_METACLASS_$_BMKTapDetectingView in BaiduMapAPI_Map(BMKTapDetectingView.o)
      _OBJC_METACLASS_$_BMKInternalMapView in BaiduMapAPI_Map(MapView.o)
      _OBJC_METACLASS_$_BMKMapView in BaiduMapAPI_Map(BMKMapView.o)
      ...
  "_UIDeviceOrientationDidChangeNotification", referenced from:
      -[BMKMapView registerNotification] in BaiduMapAPI_Map(BMKMapView.o)
      -[BMKMapView unRegisterNotification] in BaiduMapAPI_Map(BMKMapView.o)
  "_OBJC_CLASS_$_UILongPressGestureRecognizer", referenced from:
      objc-class-ref in BaiduMapAPI_Map(BMKTapDetectingView.o)
      objc-class-ref in BaiduMapAPI_Map(BMKAnnotationView.o)
  "_NSParagraphStyleAttributeName", referenced from:
      _baidu_vi::vi_map::GenTextImage(unsigned short*, unsigned int, unsigned int, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned long, unsigned long, unsigned long, unsigned int, int, _baidu_vi::vi_map::TextAlignedType) in BaiduMapAPI_Base(VBGL.o)
  "_OBJC_CLASS_$_UIApplication", referenced from:
      objc-class-ref in BaiduMapAPI_Map(MapView.o)
      objc-class-ref in BaiduMapAPI_Base(BMLogService.o)
      objc-class-ref in BaiduMapAPI_Base(VDeviceAPI.o)
  "_OBJC_CLASS_$_UIScreen", referenced from:
      objc-class-ref in BaiduMapAPI_Map(EAGLView.o)
      objc-class-ref in BaiduMapAPI_Map(BMMapViewManager.o)
      objc-class-ref in BaiduMapAPI_Map(HardwareInfo.o)
      objc-class-ref in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
      objc-class-ref in BaiduMapAPI_Search(BMKBaseURLResponseSerialization.o)
      objc-class-ref in BaiduMapAPI_Base(BMSDKDeviceInfo.o)
      objc-class-ref in BaiduMapAPI_Base(UIDeviceScreen.o)
      ...
  "_OBJC_CLASS_$_UIView", referenced from:
      _OBJC_CLASS_$_BaseMapScaleView in BaiduMapAPI_Map(BaseMapScaleView.o)
      _OBJC_CLASS_$_BMKOverlayView in BaiduMapAPI_Map(BMKOverlayView.o)
      _OBJC_CLASS_$_CompassView in BaiduMapAPI_Map(CompassView.o)
      objc-class-ref in BaiduMapAPI_Map(CompassView.o)
      _OBJC_CLASS_$__BMK_BaiduMap_EAGLView in BaiduMapAPI_Map(EAGLView.o)
      _OBJC_CLASS_$_BMKTapDetectingView in BaiduMapAPI_Map(BMKTapDetectingView.o)
      objc-class-ref in BaiduMapAPI_Map(MapView.o)
      ...
  "_OBJC_CLASS_$_UIControl", referenced from:
      _OBJC_CLASS_$_PaopaoButton in BaiduMapAPI_Map(PaopaoBaseView.o)
  "_OBJC_CLASS_$_UITextView", referenced from:
      objc-class-ref in BaiduMapAPI_Base(BMLogService.o)
  "_OBJC_CLASS_$_UILabel", referenced from:
      objc-class-ref in BaiduMapAPI_Map(PaopaoBaseView.o)
  "_UIApplicationDidBecomeActiveNotification", referenced from:
      -[BMKMapView registerNotification] in BaiduMapAPI_Map(BMKMapView.o)
      -[BMKMapView unRegisterNotification] in BaiduMapAPI_Map(BMKMapView.o)
  "_OBJC_CLASS_$_UIImage", referenced from:
      objc-class-ref in BaiduMapAPI_Map(BMKOverlayView.o)
      objc-class-ref in BaiduMapAPI_Map(BMKPinAnnotationView.o)
      objc-class-ref in BaiduMapAPI_Map(CompassView.o)
      objc-class-ref in BaiduMapAPI_Map(BMKMapView.o)
      objc-class-ref in BaiduMapAPI_Map(LocationView.o)
      objc-class-ref in BaiduMapAPI_Search(BMKBaseURLResponseSerialization.o)
      l_OBJC_$_CATEGORY_UIImage_$_BMKBaseNetworkingSafeImageLoading in BaiduMapAPI_Search(BMKBaseURLResponseSerialization.o)
      ...
  "_UIApplicationMain", referenced from:
      _main in main.o
  "_OBJC_CLASS_$_UIDevice", referenced from:
      objc-class-ref in BaiduMapAPI_Map(LocalMapImport.o)
      objc-class-ref in BaiduMapAPI_Map(LocalMap.o)
      objc-class-ref in BaiduMapAPI_Map(BMKAnnotationView.o)
      objc-class-ref in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
      objc-class-ref in BaiduMapAPI_Base(BMSDKDeviceInfo.o)
      objc-class-ref in BaiduMapAPI_Base(UIDeviceScreen.o)
      objc-class-ref in BaiduMapAPI_Base(VBGL.o)
      ...
     (maybe you meant: _OBJC_CLASS_$_UIDeviceScreen)
  "_OBJC_CLASS_$_UIFont", referenced from:
      objc-class-ref in BaiduMapAPI_Map(BaseMapScaleView.o)
      objc-class-ref in BaiduMapAPI_Map(PaopaoBaseView.o)
      objc-class-ref in BaiduMapAPI_Base(VBGL.o)
      objc-class-ref in BaiduMapAPI_Base(BMLogService.o)
  "_OBJC_CLASS_$_UIViewController", referenced from:
      _OBJC_CLASS_$_ViewController in ViewController.o
  "_NSFontAttributeName", referenced from:
      +[BMKVIDrawTextHelper sizeWithFont:strings:] in BaiduMapAPI_Base(VBGL.o)
      _baidu_vi::vi_map::GenTextImage(unsigned short*, unsigned int, unsigned int, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned long, unsigned long, unsigned long, unsigned int, int, _baidu_vi::vi_map::TextAlignedType) in BaiduMapAPI_Base(VBGL.o)
      _baidu_vi::vi_map::GetFontTextrueSizeOS(unsigned short*, unsigned int, unsigned int, unsigned short*) in BaiduMapAPI_Base(VBGL.o)
      _baidu_vi::vi_map::MetricTextFontSizeOS(unsigned short*, int, unsigned int, unsigned int, float&, float&) in BaiduMapAPI_Base(VBGL.o)
  "_OBJC_CLASS_$_UIColor", referenced from:
      objc-class-ref in BaiduMapAPI_Map(BaseMapScaleView.o)
      objc-class-ref in BaiduMapAPI_Map(BMKGradient.o)
      objc-class-ref in BaiduMapAPI_Map(BMKOverlayView.o)
      objc-class-ref in BaiduMapAPI_Map(BMKOverlayGLBasicView.o)
      objc-class-ref in BaiduMapAPI_Map(PaopaoBaseView.o)
      objc-class-ref in BaiduMapAPI_Map(MapView.o)
      objc-class-ref in BaiduMapAPI_Map(BMKGradient+Interval.o)
      ...
  "_OBJC_CLASS_$_UIImageView", referenced from:
      objc-class-ref in BaiduMapAPI_Map(CompassView.o)
      objc-class-ref in BaiduMapAPI_Map(BMKMapView.o)
      objc-class-ref in BaiduMapAPI_Base(StretchImageUtil.o)
  "_UIImagePNGRepresentation", referenced from:
      _baidu_vi::vi_map::WriteBitmapToFile(void*, int, int, int) in BaiduMapAPI_Base(VBGL.o)
      _baidu_vi::SaveBufferBmp2Png(char*, int, int, int, _baidu_vi::CVString&) in BaiduMapAPI_Base(VOSPng.o)
  "_UIGraphicsGetCurrentContext", referenced from:
      -[BaseMapScaleView drawRect:] in BaiduMapAPI_Map(BaseMapScaleView.o)
      -[BMKOverlayView drawRect:] in BaiduMapAPI_Map(BMKOverlayView.o)
      -[BaiduMapEAGLView drawRect:] in BaiduMapAPI_Map(EAGLView.o)
      -[BMKMapView takeSnapshot:] in BaiduMapAPI_Map(BMKMapView.o)
      -[SingleCircleView drawRect:] in BaiduMapAPI_Map(LocationView.o)
      _baidu_vi::SaveBufferBmp2Png(char*, int, int, int, _baidu_vi::CVString&) in BaiduMapAPI_Base(VOSPng.o)
  "_NSBackgroundColorAttributeName", referenced from:
      _baidu_vi::vi_map::GenTextImage(unsigned short*, unsigned int, unsigned int, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned long, unsigned long, unsigned long, unsigned int, int, _baidu_vi::vi_map::TextAlignedType) in BaiduMapAPI_Base(VBGL.o)
  "_OBJC_CLASS_$_UIResponder", referenced from:
      _OBJC_CLASS_$_AppDelegate in AppDelegate.o
  "_OBJC_METACLASS_$_UIResponder", referenced from:
      _OBJC_METACLASS_$_AppDelegate in AppDelegate.o
  "_UIGraphicsEndImageContext", referenced from:
      -[BMKMapView takeSnapshot:] in BaiduMapAPI_Map(BMKMapView.o)
      _baidu_vi::SaveBufferBmp2Png(char*, int, int, int, _baidu_vi::CVString&) in BaiduMapAPI_Base(VOSPng.o)
  "_OBJC_METACLASS_$_UIViewController", referenced from:
      _OBJC_METACLASS_$_ViewController in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

从网上查询得知,需要将Target->Build Settings->Compile Source AS,从Objective-C++改为Objective-C

而后,报错信息为:

Undefined symbols for architecture x86_64:
  "_SCNetworkReachabilityGetFlags", referenced from:
      ___52-[BMKBaseNetworkReachabilityManager startMonitoring]_block_invoke.55 in BaiduMapAPI_Search(BMKBaseNetworkReachabilityManager.o)
      -[BMKReachability connectionRequired] in BaiduMapAPI_Base(BMReachability.o)
      -[BMKReachability currentReachabilityStatus] in BaiduMapAPI_Base(BMReachability.o)
  "_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
      -[BMKBaseNetworkReachabilityManager stopMonitoring] in BaiduMapAPI_Search(BMKBaseNetworkReachabilityManager.o)
      -[BMKReachability stopNotifer] in BaiduMapAPI_Base(BMReachability.o)
  "_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
      -[BMKBaseNetworkReachabilityManager startMonitoring] in BaiduMapAPI_Search(BMKBaseNetworkReachabilityManager.o)
      -[BMKReachability startNotifer] in BaiduMapAPI_Base(BMReachability.o)
  "_kUTTagClassMIMEType", referenced from:
      -[BMKBaseStreamingMultipartFormData appendPartWithFileURL:name:error:] in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
  "_SCNetworkReachabilityCreateWithName", referenced from:
      +[BMKBaseNetworkReachabilityManager managerForDomain:] in BaiduMapAPI_Search(BMKBaseNetworkReachabilityManager.o)
      +[BMKReachability reachabilityWithHostName:] in BaiduMapAPI_Base(BMReachability.o)
  "_kUTTagClassFilenameExtension", referenced from:
      -[BMKBaseStreamingMultipartFormData appendPartWithFileURL:name:error:] in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
  "_SCNetworkReachabilitySetCallback", referenced from:
      -[BMKBaseNetworkReachabilityManager startMonitoring] in BaiduMapAPI_Search(BMKBaseNetworkReachabilityManager.o)
      -[BMKReachability startNotifer] in BaiduMapAPI_Base(BMReachability.o)
  "_UTTypeCreatePreferredIdentifierForTag", referenced from:
      -[BMKBaseStreamingMultipartFormData appendPartWithFileURL:name:error:] in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
  "_SCNetworkReachabilityCreateWithAddress", referenced from:
      +[BMKBaseNetworkReachabilityManager managerForAddress:] in BaiduMapAPI_Search(BMKBaseNetworkReachabilityManager.o)
      +[BMKReachability reachabilityWithAddress:] in BaiduMapAPI_Base(BMReachability.o)
  "_UTTypeCopyPreferredTagWithClass", referenced from:
      -[BMKBaseStreamingMultipartFormData appendPartWithFileURL:name:error:] in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

应该是网络相关的库文件缺失。添加库文件SystemConfiguration.framework之后

还会报错如下:

Undefined symbols for architecture x86_64:
  "_kUTTagClassFilenameExtension", referenced from:
      -[BMKBaseStreamingMultipartFormData appendPartWithFileURL:name:error:] in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
  "_kUTTagClassMIMEType", referenced from:
      -[BMKBaseStreamingMultipartFormData appendPartWithFileURL:name:error:] in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
  "_UTTypeCreatePreferredIdentifierForTag", referenced from:
      -[BMKBaseStreamingMultipartFormData appendPartWithFileURL:name:error:] in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
  "_UTTypeCopyPreferredTagWithClass", referenced from:
      -[BMKBaseStreamingMultipartFormData appendPartWithFileURL:name:error:] in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

再添加库文件 MobileCoreServices.framework能够编译成功。

大部分Undefined symbols for architecture x86_64都是缺失库文件导致的,可以根据报错信息确定缺失的库文件,添加到工程。

### 回答1: undefined symbols for architecture x86_64 意思是在编译或链接时,找不到指定的符号或函数。这通常是由于缺少库文件或头文件,或者代码中存在语法错误或逻辑错误导致的。需要检查代码和依赖项,以解决这个问题。 ### 回答2: “undefined symbols for architecture x86_64”这个错误信息通常出现在使用C/C++语言进行编程时。这个错误表示在链接时缺少符号,编译器无法找到函数或变量的定义。在x86_64架构中,符号可能是函数、变量或其他代码,因此需要通过特定的符号解析过程来定义他们。 这个错误可以通过以下方法解决: 1.检查代码中是否有定义所有需要的函数和变量,如果有遗漏,需要添加定义。 2.检查头文件和库文件是否正确包含,必须确保所有必需的头文件和库文件都被正确链接。 3.检查编译器选项和链接器选项是否正确设置。如果编译时使用了新的标志或选项,可能需要更新链接器选项。 4.如果代码中使用了某些外部库的函数,则需要确保库已经被正确添加到链接器中。 5.如果使用了静态库,那么需要确保发布的静态库文件与正在编译的代码是匹配的。 在解决了上述问题后,编译器会将代码重新链接,以确保所有符号被正确解析。此时,就可以消除“undefined symbols for architecture x86_64”的错误提示,顺利完成编译和链接过程。 ### 回答3: "undefined symbols for architecture x86_64"是一种错误信息,通常出现在使用编译器或链接器编译和构建程序的过程中。这个错误信息表明,编译器或链接器无法找到代码中引用的某些函数或变量的定义。 这个错误信息提示中的“architecture x86_64”表示代码的编译架构是x86_64,即64位的x86架构。这个错误还可以在其他架构上出现,如ARM架构等。 这种错误通常是由于程序中调用的某些库或函数没有正确地链接到程序中,或者库或函数的定义没有包括在项目中导致的。解决这个问题的一种方法是检查相关的库或函数是否正确地链接到程序中,并确保它们的定义包括在项目中。可以使用命令行工具或IDE中的链接器选项来解决这个问题。 此外,也有可能是由于程序中使用了已过时的函数或库,或者程序中的代码出现了错误。在这种情况下,需要检查代码并修复错误,或者使用更新的函数或库来替换旧代码。 总之,“undefined symbols for architecture x86_64”是一个指出编译/链接过程中可执行文件依赖库不匹配或者找不到库函数的错误信息,需要检查相关链接库、函数定义文件和编译器选项并修正代码错误,以解决此问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值