gpt4 book ai didi

iphone - 在 Xcode 中创建 Objective-C++ 静态库

转载 作者:太空狗 更新时间:2023-10-30 03:22:36 25 4
gpt4 key购买 nike

所以我为 iPhone 开发了一个引擎,我想用它来构建几个不同的游戏。与其在每个游戏的项目目录中复制和粘贴引擎文件,不如从每个游戏链接到引擎,因此如果我需要对其进行更改,我只需这样做一次。稍作研究后,静态库似乎是在 iPhone 上执行此操作的最佳方式。

我创建了一个名为 Skeleton 的新项目,并将所有引擎文件复制到其中。我用了this创建静态库的指南,我将该库导入到名为 Chooser 的项目中。然而,当我尝试编译该项目时,Xcode 开始提示我在名为 ControlScene.mm 的文件中包含的一些 C++ 数据结构。这是我的构建错误:

  "operator delete(void*)", referenced from:


-[ControlScene dealloc] in libSkeleton.a(ControlScene.o)


-[ControlScene init] in libSkeleton.a(ControlScene.o)


__gnu_cxx::new_allocator<operation_t>::deallocate(operation_t*, unsigned long)in libSkeleton.a(ControlScene.o)


__gnu_cxx::new_allocator<operation_t*>::deallocate(operation_t**, unsigned long)in libSkeleton.a(ControlScene.o)


"operator new(unsigned long)", referenced from:


-[ControlScene init] in libSkeleton.a(ControlScene.o)


__gnu_cxx::new_allocator<operation_t*>::allocate(unsigned long, void const*)in libSkeleton.a(ControlScene.o)


__gnu_cxx::new_allocator<operation_t>::allocate(unsigned long, void const*)in libSkeleton.a(ControlScene.o)


"std::__throw_bad_alloc()", referenced from:


__gnu_cxx::new_allocator<operation_t*>::allocate(unsigned long, void const*)in libSkeleton.a(ControlScene.o)


__gnu_cxx::new_allocator<operation_t>::allocate(unsigned long, void const*)in libSkeleton.a(ControlScene.o)


"___cxa_rethrow", referenced from:


std::_Deque_base<operation_t, std::allocator<operation_t> >::_M_create_nodes(operation_t**, operation_t**)in libSkeleton.a(ControlScene.o)


std::_Deque_base<operation_t, std::allocator<operation_t> >::_M_initialize_map(unsigned long)in libSkeleton.a(ControlScene.o)


"___cxa_end_catch", referenced from:


std::_Deque_base<operation_t, std::allocator<operation_t> >::_M_create_nodes(operation_t**, operation_t**)in libSkeleton.a(ControlScene.o)


std::_Deque_base<operation_t, std::allocator<operation_t> >::_M_initialize_map(unsigned long)in libSkeleton.a(ControlScene.o)


"___gxx_personality_v0", referenced from:


___gxx_personality_v0$non_lazy_ptr in libSkeleton.a(ControlScene.o)


___gxx_personality_v0$non_lazy_ptr in libSkeleton.a(MenuLayer.o)


"___cxa_begin_catch", referenced from:


std::_Deque_base<operation_t, std::allocator<operation_t> >::_M_create_nodes(operation_t**, operation_t**)in libSkeleton.a(ControlScene.o)


std::_Deque_base<operation_t, std::allocator<operation_t> >::_M_initialize_map(unsigned long)in libSkeleton.a(ControlScene.o)


ld: symbol(s) not found


collect2: ld returned 1 exit status

如果有人可以提供一些关于为什么会出现这些问题的见解,我将不胜感激。

最佳答案

将“-lstdc++”设置为其他链接器标志

关于iphone - 在 Xcode 中创建 Objective-C++ 静态库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2846679/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com