xcode6.0升級到xcode6.1後,程式編譯報錯,錯誤如下:這是個很常見的錯誤,很多項目在更換xcode版本後,都會出現類似的問題。
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_QQApiInterface", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_ShareSDK", referenced from:
objc-class-ref in AppDelegate.o
objc-class-ref in RecipeDetailViewController.o
objc-class-ref in showViewController.o
objc-class-ref in video_show.o
"_OBJC_CLASS_$_TencentOAuth", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_WXApi", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_WeiboApi", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_YXApi", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解決方案:
Xcode升級到6.1.1 預設讓所有App都通過64位編譯器編譯。原來在Xcode6.0的時候預設的Architectures只有(arm7,armv7s),到6.1.1預設就帶上arm64的參數了。
1.把1.選中Targets—>Build Settings—>Architectures。
把build active architectures only 改為 NO。
2. 把最下面的Valid Architectures中的arm64參數刪掉就可以了
或者:
雙擊Architectures,選擇other,刪除$(ARCH_STANDARD),然後增加armv7和armv7s(寫上:$(ARCHS_STANDARD_32_BIT))。
3.clean 再build。
結果設定如下圖:
目前設定完成後,問題順利解決,大家有更好的解決方案,歡迎討論。