使用Tonymillion Rechability类时,链接器命令失败错误

时间:2015-11-17 14:47:29

标签: c++ ios xcode cocos2d-x

我在tonymillion Reachability类中得到了这个链接错误。我正在使用它来获取我的ios应用程序中的互联网连接。有人告诉我为什么会出现这个错误。

Ld /Users/Mathaly/Library/Developer/Xcode/DerivedData/ResQ-bkakeqfqsmrivngctueeyzttnpno/Build/Products/Debug-iphoneos/ResQ-mobile.app/ResQ-mobile normal arm64

cd /Users/Mathaly/Desktop/Gunjan/Business/LogicRoots/Game/Mathaly2/proj.ios_mac

export IPHONEOS_DEPLOYMENT_TARGET=6.0

export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -L/Users/Mathaly/Library/Developer/Xcode/DerivedData/ResQ-bkakeqfqsmrivngctueeyzttnpno/Build/Products/Debug-iphoneos -F/Users/Mathaly/Library/Developer/Xcode/DerivedData/ResQ-bkakeqfqsmrivngctueeyzttnpno/Build/Products/Debug-iphoneos -filelist /Users/Mathaly/Library/Developer/Xcode/DerivedData/ResQ-bkakeqfqsmrivngctueeyzttnpno/Build/Intermediates/ResQ.build/Debug-iphoneos/ResQ.build/Objects-normal/arm64/ResQ-mobile.LinkFileList -dead_strip -stdlib=libc++ -fobjc-link-runtime -miphoneos-version-min=6.0 -liconv -framework Security /Users/Mathaly/Library/Developer/Xcode/DerivedData/ResQ-bkakeqfqsmrivngctueeyzttnpno/Build/Products/Debug-iphoneos/libcocos2d\ iOS.a -framework CoreMotion -framework Foundation -framework UIKit -framework CoreGraphics -framework OpenGLES -lz -framework QuartzCore -framework OpenAL -framework AVFoundation -framework AudioToolbox -Xlinker -dependency_info -Xlinker /Users/Mathaly/Library/Developer/Xcode/DerivedData/ResQ-bkakeqfqsmrivngctueeyzttnpno/Build/Intermediates/ResQ.build/Debug-iphoneos/ResQ.build/Objects-normal/arm64/ResQ-mobile_dependency_info.dat -o /Users/Mathaly/Library/Developer/Xcode/DerivedData/ResQ-bkakeqfqsmrivngctueeyzttnpno/Build/Products/Debug-iphoneos/ResQ-mobile.app/ResQ-mobile

Undefined symbols for architecture arm64:

  "_SCNetworkReachabilityGetFlags", referenced from:
      -[Reachability isReachable] in Reachability.o
      -[Reachability isReachableViaWWAN] in Reachability.o
      -[Reachability isReachableViaWiFi] in Reachability.o
      -[Reachability connectionRequired] in Reachability.o
      -[Reachability isConnectionOnDemand] in Reachability.o
      -[Reachability isInterventionRequired] in Reachability.o
      -[Reachability reachabilityFlags] in Reachability.o
      ...

  "_SCNetworkReachabilitySetDispatchQueue", referenced from:
      -[Reachability startNotifier] in Reachability.o
      -[Reachability stopNotifier] in Reachability.o

  "_SCNetworkReachabilitySetCallback", referenced from:
      -[Reachability startNotifier] in Reachability.o
      -[Reachability stopNotifier] in Reachability.o

  "_SCNetworkReachabilityCreateWithAddress", referenced from:
      +[Reachability reachabilityWithAddress:] in Reachability.o

  "_SCNetworkReachabilityCreateWithName", referenced from:
      +[Reachability reachabilityWithHostname:] in Reachability.o

ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

1 个答案:

答案 0 :(得分:0)

添加SystemConfiguration Framework并将Deployment Target更改为IOS 6.0解决了我的问题。

1)添加SystemConfiguration Framework:选择您的项目,然后选择您的目标(手机/平板电脑),然后选择Build Phases

有一个名为Link Binary的块与Libraries,在它的末尾有+符号点击。它将打开一个对话框,在其中搜索系统配置,然后单击“确定/添加”。

2)更改部署目标:选择您的项目,然后选择目标(移动设备/平板电脑),然后选择构建设置。

存在部署块,然后是IOS部署目标,将其更改为IOS 6.0或更高版本。

希望这会有所帮助