그래서 저는 몇 가지 게임을 만들고 싶은 iPhone 용 엔진을 개발했습니다. 각 게임의 프로젝트 디렉토리 안에 엔진 용 파일을 복사하여 붙여 넣기보다는 각 게임의 엔진에 연결하는 방법이 있습니다. 변경해야 할 경우 한 번만해야합니다. 조금 뒤돌아 쳐 보면, 정적 라이브러리가 iPhone에서이 작업을 수행하는 가장 좋은 방법 인 것 같습니다.Xcode에서 Objective-C++ 정적 라이브러리 만들기
나는 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
누군가이 문제가 발생하는 이유에 대한 통찰력을 제공 할 수 있다면, 고맙겠습니다.
이들은 어디에 있습니까? – LandonSchropp
@helixed, Makefile 또는 명령 행에서 라이브러리를 빌드하는 경우 g ++의 호출에 추가 할 수 있습니다. Xcode를 사용하고 있다면, 당신이 입력 할 수있는 프로젝트 빌드 설정에 "다른 플래그"같은 것이 있다고 생각합니다. –
그래, 완벽하게 작동했습니다. 누군가를 궁금해하는 경우를 대비하여 다른 링커 플래그를 설정하는 것이 좋습니다. 도와 주셔서 감사합니다. – LandonSchropp