iphone - Creating an Objective-C++ Static Library in Xcode -


So I have developed an engine for the iPhone with which I want to make some different games. Instead of copying and pasting files for the engine inside the project directory of every game, I want a way to link to the engine from every game, so if I need to change it then I will have to do this once only a little bit After reading around C, it seems like the best way to do it on the iPhone like stable libraries.

I have created a new project called Skeleton and copied all of my files to it. I used the guide to create a static library and I imported the library into a project called Chuussar. However, when I tried to compile this project, Xcode started complaining about some C ++ data structures, which I had included in a file named ControllCinema.mm. Here are our construction errors:

  "operator delete (zero *)", referenced from: - libSkeleton.a (ControlScene.o) in [ControlScene dealloc] - [ControlScene init] libSkeleton.a In libSkeleton.a :: Reallocation (operation_t *, unsigned long) (ControlScene.o) __gnu_cxx :: new_allocator & lt; (ControlScene.o) __gnu_cxx :: new_allocator & lt; Operation_t & gt operation_t * & gt; :: Reverted (operation_t **, unsigned long) "operator new (unsigned long)" in libSkeleton.a (ControlScene.o), referenced from: [ControlScene init] libSkeleton.a (in ControlScene.o) __gnu_cxx :: new_allocator & Lt; Operation_t * & gt; :: Allocated (unsigned long, zero constant *) libSkeleton.a (in ControlScene.o) __gnu_cxx :: new_allocator & lt; Operation_t> :: Allocated (unsigned long, zero libSkeleton.a (constant * in ControlScene.o *)) "std :: __ throw_bad_alloc ()", referenced from: __gnu_cxx :: new_allocator & lt; Operation_t * & gt; :: Allocated in libskeleton.a (ControlScene.o) (unsigned long, zero const *) __gnu_cxx :: new_allocator & lt; Operation_t> :: Allocated in libSkeleton.a (ControlScene.o) (unsigned long, zero constant *) "___cxa_rethrow", referenced from: std :: _ Deque_base & LT; Operation_t, std :: communicator & lt; Operation_t> & Gt; :: _ M_create_nodes (operation_t **, operation_t **) libSkeleton.a (ControlScene.o) std :: _ Deque_base & lt; Operation_t, std :: allocator & lt; Operation_t> ; & Gt :: _ M_initialize_map (unsigned long) in libSkeleton.a (ControlScene.o) "___cxa_end_catch", referenced from: std :: _ Deque_base & LT; Operation_t, std :: communicator & lt; Operation_t> & Gt; :: _ M_create_nodes (operation_t **, operation_t **) libSkeleton.a (ControlScene.o) std :: _ Deque_base & lt; Operation_t, std :: allocator & lt; Operation_t> & Gt; Libskeleton.a (ControlScene.o): ___Initialize_map (signed long) refers to "___gxx_personality_v0", 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 & lt; Operation_t, std :: allocator & lt; Operation_t> & Gt; :: _ M_create_nodes (operation_t **, operation_t **) libSkeleton.a (ControlScene.o) std :: _ Deque_base & lt; Operation_t, std :: allocator & lt; Operation_t> & Gt; Libskeleton.a (ControlScene.o) LD: Sign (s) not found in M_initialize_map (signed long) 2: LD back 1 exit status  

If some insights I can appreciate why these problems are happening, I appreciate it.

The problem is that your library is dynamically linking against libstdc ++ how to fix it , You should try "-static-libstdc ++", and "-static-libgcc" in different combinations when making your library (not sure which of them is necessary, but it should be some combination of it completely Make Stable with.)

Edit
Well, it has come to know that you have Libertad on the iPhone Allow to dynamically link with the C + +, so is actually a better solution just "-lstdc ++" (that is, the link is clearly against the Libstdisi ++) in your build.


Comments