我正在尝试使用OGRE框架构建一个iPhone应用程序,并且在构建模拟器时遇到链接器错误,我不确定如何修复。
我使用OGRE iPhone模板创建了Xcode项目。我正在使用来自主网站Ogre_iOS_4.0_Dependencies_20100623
的OGRE的静态库,并尝试为iOS 4.1模拟器构建。我在Mac OS X 10.6.4上使用Xcode 3.2.4构建。
编译似乎工作正常,但当它进入链接阶段时,我收到以下错误:
Ld build/Debug-iphonesimulator/OgreTestApp.app/OgreTestApp normal i386
cd /Users/pauly/Projects/workspaces/games/OgreTestApp
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk -L/Users/pauly/Projects/workspaces/games/OgreTestApp/build/Debug-iphonesimulator -L/Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release -L/Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/iPhoneDependencies/lib/release -F/Users/pauly/Projects/workspaces/games/OgreTestApp/build/Debug-iphonesimulator -filelist /Users/pauly/Projects/workspaces/games/OgreTestApp/build/OgreTestApp.build/Debug-iphonesimulator/OgreTestApp.build/Objects-normal/i386/OgreTestApp.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -lboost_date_time -lboost_thread -lFreeImage -lFreeType -lOIS -lzzip -lOgreMainStatic -lRenderSystem_GLESStatic -lPlugin_BSPSceneManagerStatic -lPlugin_OctreeSceneManagerStatic -lPlugin_ParticleFXStatic -o /Users/pauly/Projects/workspaces/games/OgreTestApp/build/Debug-iphonesimulator/OgreTestApp.app/OgreTestApp
ld: warning: __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::allocate(unsigned long, void const*)has different visibility (default) in /Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release/libOIS.a(OISInputManager.o) and (hidden) in /Users/pauly/Projects/workspaces/games/OgreTestApp/build/OgreTestApp.build/Debug-iphonesimulator/OgreTestApp.build/Objects-normal/i386/OgreFramework.o
ld: warning: std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_create_node(std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)has different visibility (default) in /Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release/libOIS.a(OISInputManager.o) and (hidden) in /Users/pauly/Projects/workspaces/games/OgreTestApp/build/OgreTestApp.build/Debug-iphonesimulator/OgreTestApp.build/Objects-normal/i386/OgreFramework.o
ld: warning: std::char_traits<char>::eq(char const&, char const&)has different visibility (hidden) in /Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release/libFreeImage.a(IPTC.o) and (default) in /Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release/libOgreMainStatic.a(OgreString.o)
ld: warning: std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_insert_aux(__gnu_cxx::__normal_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)has different visibility (hidden) in /Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release/libFreeImage.a(IPTC.o) and (default) in /Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release/libOgreMainStatic.a(OgreScriptCompiler.o)
Undefined symbols:
".objc_class_name_NSAutoreleasePool", referenced from:
literal-pointer@__OBJC@__cls_refs@NSAutoreleasePool in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
".objc_class_name_UIApplication", referenced from:
literal-pointer@__OBJC@__cls_refs@UIApplication in libOIS.a(iPhoneInputManager.o)
".objc_class_name_UIWindow", referenced from:
literal-pointer@__OBJC@__cls_refs@UIWindow in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
".objc_class_name_UIView", referenced from:
.objc_class_name_InputDelegate in libOIS.a(iPhoneInputManager.o)
.objc_class_name_EAGLView in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
".objc_class_name_UIAccelerometer", referenced from:
literal-pointer@__OBJC@__cls_refs@UIAccelerometer in libOIS.a(iPhoneInputManager.o)
literal-pointer@__OBJC@__cls_refs@UIAccelerometer in libOIS.a(iPhoneAccelerometer.o)
".objc_class_name_CAEAGLLayer", referenced from:
literal-pointer@__OBJC@__cls_refs@CAEAGLLayer in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
".objc_class_name_EAGLContext", referenced from:
literal-pointer@__OBJC@__cls_refs@EAGLContext in libRenderSystem_GLESStatic.a(OgreEAGLESContext.o)
".objc_class_name_NSDictionary", referenced from:
literal-pointer@__OBJC@__cls_refs@NSDictionary in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
".objc_class_name_NSNumber", referenced from:
literal-pointer@__OBJC@__cls_refs@NSNumber in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
".objc_class_name_UIScreen", referenced from:
literal-pointer@__OBJC@__cls_refs@UIScreen in libOIS.a(iPhoneInputManager.o)
literal-pointer@__OBJC@__cls_refs@UIScreen in libRenderSystem_GLESStatic.a(OgreEAGLSupport.o)
literal-pointer@__OBJC@__cls_refs@UIScreen in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
我该如何解决这个问题?感谢。
答案 0 :(得分:0)
对于正确的iOS SDK版本,您可能需要正确的预编译Ogre依赖项(Masterfalcon会定期在ogre3d.org上发布这些依赖项)。 类似的链接器错误通常是由不正确的iPhoneDependencies(为您拥有的旧版iPhoneSKD构建)引起的。
只需按照此处列出的说明操作即可: http://www.ogre3d.org/tikiwiki/Building+Ogre+with+CMake Secion“为iPhone配置”。 一切都应该建立好。