使用 OGRE 库为模拟器编译 iPhone 应用程序时出现链接器错误

发布于 2024-09-25 07:43:22 字数 6876 浏览 10 评论 0原文

我正在尝试使用 OGRE 框架构建 iPhone 应用程序,但在构建模拟器时遇到链接器错误,我不确定如何修复。

我使用 OGRE iPhone 模板创建了 Xcode 项目。我正在使用主网站 Ogre_iOS_4.0_Dependency_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

如何解决此问题?谢谢。

I'm trying to build an iPhone app using the OGRE framework, and I'm getting a linker error when building for the simulator that I'm not sure how to fix.

I created the Xcode project using the OGRE iPhone template. I'm using the static libraries for OGRE from the main website, Ogre_iOS_4.0_Dependencies_20100623, and trying to build for the iOS 4.1 Simulator. I'm building with Xcode 3.2.4 on Mac OS X 10.6.4.

Compilation seems to work fine, but when it gets to the link stage, I get the following errors:

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

How do I fix this? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瘫痪情歌 2024-10-02 07:43:23

可能您需要正确的预编译 Ogre 依赖项才能获得正确的 iOS SDK 版本(Masterfalcon 定期在 ogre3d.org 上发布这些依赖项)。
类似的链接器错误通常是由不正确的 iPhoneDependency 引起的(为您拥有的旧 iPhoneSKD 构建)。

只需按照此处列出的说明进行操作即可:
http://www.ogre3d.org/tikiwiki/Building+Ogre+with+CMake
“为 iPhone 配置”部分。
一切都应该建立得很好。

Probably you need correct precompiled Ogre dependencies for correct iOS SDK version (Masterfalcon regularly publish those dependencies on the ogre3d.org).
Similar linker errors often caused by incorrect iPhoneDependencies (build for older iPhoneSKD that you have).

Just follow the instructions as listed here:
http://www.ogre3d.org/tikiwiki/Building+Ogre+with+CMake
Secion "Configuring for iPhone".
All should build fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文