Question

I'm trying to use the Google Plus SDK for sharing in an iOS 6.1 app and get a linker error after adding the GooglePlus.framework and the GoogleOpenSource.framework.

Merely including the frameworks and building yields the following errors:

Undefined symbols for architecture armv7:
"_CGRectDivide", referenced from:
  -[GTMOAuth2ViewControllerTouch moveWebViewFromUnderNavigationBar] in GTMOAuth2ViewControllerTouch.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've followed instructions found in the Google guide to no avail. I've done the following:

  1. Included SystemConfiguration.framework and Security.framework
  2. Dragged and dropped the GooglePlus.framework and the GoogleOpenSource.framework from the SDK into my XCode project
  3. Added the -ObjC flag to the app target's build settings

In addition to the previous steps I also tried adding the contents of the OpenSource folder provided in the SDK but that had no effect caused additional problems after the initial fix.

Libraries:

My included libraries

Full error message:

 Ld "/Users/me/Library/Developer/Xcode/DerivedData/MyApp-asdf/Build/Intermediates/MyApp.build/
 Debug-iphoneos/MyAoo.build/Objects-normal/armv7/MyApp" normal armv7
     cd /Users/me/code/MyApp
     setenv IPHONEOS_DEPLOYMENT_TARGET 6.1
     setenv 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 armv7 -isysroot
 /Applications/Xcode.app/Contents/Developer/     
 Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk 

 -L/Users/me/Library/Developer/Xcode/DerivedData/
 MyApp-asdf/Build/Products/Debug-iphoneos

 -L/Users/me/code/MyApp/MyApp 

 -F/Users/me/Library/Developer/Xcode/DerivedData/MyApp-asdf/Build/Products/Debug-iphoneos 

 -F/Users/me/code/MyApp/../../Documents/FacebookSDK -F/Users/me/code/MyApp 

 -F/Users/me/code/MyApp/MyApp 

 -filelist "/Users/me/Library/Developer/Xcode/
 DerivedData/MyApp-asdf/Build/Intermediates/
 MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/MyApp.LinkFileList"

 -dead_strip -ObjC -lsqlite3.0 -fobjc-arc 
 -fobjc-link-runtime -miphoneos-version-min=6.1 
 -framework SystemConfiguration -framework Security 
 -framework CFNetwork -framework Social -framework Accounts 
 -framework EventKit -framework EventKitUI 
 -framework AVFoundation -framework MapKit  
 -framework Twitter -framework CoreMotion -framework CoreLocation 
 -lxml2 -framework QuartzCore 
 -framework MobileCoreServices -framework CoreData
 -framework UIKit -framework Foundation 
 -framework Pinterest -framework GooglePlus 
 -framework GoogleOpenSource 
 -lGooglePlusUniversal -o 

 "/Users/me/Library/Developer/
 Xcode/DerivedData/MyApp-asdf/Build/Intermediates/MyApp.build/
 Debug-iphoneos/MyApp.build/Objects-normal/armv7/MyApp"

 Undefined symbols for architecture armv7:
   "_CGRectDivide", referenced from:
       -[GTMOAuth2ViewControllerTouch moveWebViewFromUnderNavigationBar] in 
   GTMOAuth2ViewControllerTouch.o
 ld: symbol(s) not found for architecture armv7
 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I'm not sure what I missed but any help would be greatly appreciated.

Was it helpful?

Solution

Also link in the CoreGraphics framework. It's looking for the CGRectDivide method, which is part of CoreGraphics.

OTHER TIPS

This error is caused by adding OpenSource folder to you project, xcode detects that there is a duplication of files. So you should only add GooglePlus.framework and the GoogleOpenSource.framework.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top