ios – 链接器错误 – 使用Cardboard SDK创建MainAppain __EXPECTED_EXACTLY_ONE_VR_MAIN_APP_STATEMENT__

我正在开发一个Google Cardboard应用程序并在iOS中构建良好.但是将Soomla添加到项目会导致链接器错误:

Ld /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/RealiteerCore normal armv7
cd /Users/foundway/GitHub/RealiteerCore/Build/RealiteerCoreIOS
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 armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -L/Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Products/Release-iphoneos -L/Users/foundway/GitHub/RealiteerCore/Build/RealiteerCoreIOS -L/Users/foundway/GitHub/RealiteerCore/Build/RealiteerCoreIOS/Libraries -L/Applications/Unity/Unity.app/Contents/PlaybackEngines/iOSSupport/Trampoline/Libraries -L/Users/foundway/GitHub/RealiteerCore/Assets/Plugins/iOS -F/Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Products/Release-iphoneos -filelist /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/RealiteerCore.LinkFileList -Xlinker -map -Xlinker /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/RealiteerCore-LinkMap-normal-armv7.txt -dead_strip -lc++ -weak_framework CoreMotion -weak-lSystem -ObjC -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -framework Security -framework CoreText -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework OpenAL -liconv.2 -framework AudioToolbox -framework CFNetwork -framework MediaPlayer -framework CoreLocation -framework SystemConfiguration -weak_framework iAd -framework CoreMedia -framework CoreVideo -weak_framework AVFoundation -framework CoreGraphics -weak_framework CoreMotion -liPhone-lib-il2cpp -liontext -lVuforia -lcardboard -lionimagecompression -lionimage -lremote_assets -lport -levent_internal -lQuantumCore -lbase -lNimbusCore -lrecorder -liongfx -lprotos_lib -lsoftware -lionwebp -lcardboard_protos -lionportgfx -lionstblib -lGoogleKitHUD -lionmath -lionlodepnglib -liongfxutils -lsensors -ltype -lapi -lprotobuf -lionfreetype2 -lionremote -lNimbusAttributedLabel -llogging -lProtocolBuffers -lUnityiOSProfile -lplatform -lSoomlaIOSCore -lvr -lionport -lcomposite -ldatatypes -ldevice -lNimbusModels -levent -lionanalytics -lgflags -lQCARUnityPlayer -lionbase -lionjsoncpp -lionzlib -ldevice_internal -lionmongoose -lGoogleKitCore -lionopenctm -lvrunity -lSoomlaiOSProfile -lUnitySoomlaiOSCore -llogging_protos -lionprofile -lsqlite3.0 -Xlinker -dependency_info -Xlinker /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/RealiteerCore_dependency_info.dat -o /Users/foundway/Library/Developer/Xcode/DerivedData/Unity-iPhone-grxtfxrygreysieuyeovxlhlmgxu/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/RealiteerCore

Undefined symbols for architecture armv7:
  "gvr::CreateMainApp__EXPECTED_EXACTLY_ONE_VR_MAIN_APP_STATEMENT__(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)", referenced from:
      l001 in libplatform.a(vr_ios.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我刚刚将Soomla添加到我的Cardboard应用程序中,但看起来像Soomla和Google Cardboard正在争夺主应用程序(libplatform.a来自Google Cardboard).我认为Google Cardboard需要成为主要的应用程序.

所以,我想知道是否有方法可以使其他插件不为主应用程序而战?

它也可能是其他东西……仅仅是我的理论.

最佳答案 这是因为Xcode构建标志-ObjC,它改变了.a文件的链接方式. Cardboard SDK本身不需要(或想要)的Cardboard .a文件中有一些代码(例如,CreateMainApp).

您可以通过从Xcode中的链接标志中删除-ObjC标志来解决此问题.注意:这可能会导致Soomla无法链接,但希望它们只包含它“以防万一”.所以先尝试一下,如果仍然失败,请在这里评论.

点赞