美文网首页程序员
集成百度地图SDK-Undefined symbols for

集成百度地图SDK-Undefined symbols for

作者: 竹与豆 | 来源:发表于2018-06-25 13:45 被阅读61次

    集成百度地图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都是缺失库文件导致的,可以根据报错信息确定缺失的库文件,添加到工程。

    相关文章

      网友评论

        本文标题:集成百度地图SDK-Undefined symbols for

        本文链接:https://www.haomeiwen.com/subject/erhyyftx.html