title: Creating an Objective-C++ Static Library in Xcode
body: <p>So I've developed an engine for the iPhone with which I'd like to build a couple different games.  Rather than copy and paste the files for the engine inside of each game's project directory, I'd a way to link to the engine from each game, so if I need to make a change to it I only have to do so once.  After reeding around a little bit, it seems like static libraries are the best way to do this on the iPhone.  </p>
  
  <p>I created a new project called Skeleton and copied all of my engine files over to it.  I used <a href="http://www.amateurinmotion.com/articles/2009/02/08/creating-a-static-library-for-iphone.html" rel="noreferrer">this</a> guide to create a static library, and I imported the library into a project called Chooser.  However, when I tried to compile the project, Xcode started complaining about some C++ data structures I included in a file called ControlScene.mm.  Here's my build errors:</p>
  
  <pre><code>  "operator delete(void*)", referenced from:
  
  
        -[ControlScene dealloc] in libSkeleton.a(ControlScene.o)
  
  
        -[ControlScene init] in libSkeleton.a(ControlScene.o)
  
  
        __gnu_cxx::new_allocator&lt;operation_t&gt;::deallocate(operation_t*, unsigned long)in libSkeleton.a(ControlScene.o)
  
  
        __gnu_cxx::new_allocator&lt;operation_t*&gt;::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&lt;operation_t*&gt;::allocate(unsigned long, void const*)in libSkeleton.a(ControlScene.o)
  
  
        __gnu_cxx::new_allocator&lt;operation_t&gt;::allocate(unsigned long, void const*)in libSkeleton.a(ControlScene.o)
  
  
    "std::__throw_bad_alloc()", referenced from:
  
  
        __gnu_cxx::new_allocator&lt;operation_t*&gt;::allocate(unsigned long, void const*)in libSkeleton.a(ControlScene.o)
  
  
        __gnu_cxx::new_allocator&lt;operation_t&gt;::allocate(unsigned long, void const*)in libSkeleton.a(ControlScene.o)
  
  
    "___cxa_rethrow", referenced from:
  
  
        std::_Deque_base&lt;operation_t, std::allocator&lt;operation_t&gt; &gt;::_M_create_nodes(operation_t**, operation_t**)in libSkeleton.a(ControlScene.o)
  
  
        std::_Deque_base&lt;operation_t, std::allocator&lt;operation_t&gt; &gt;::_M_initialize_map(unsigned long)in libSkeleton.a(ControlScene.o)
  
  
    "___cxa_end_catch", referenced from:
  
  
        std::_Deque_base&lt;operation_t, std::allocator&lt;operation_t&gt; &gt;::_M_create_nodes(operation_t**, operation_t**)in libSkeleton.a(ControlScene.o)
  
  
        std::_Deque_base&lt;operation_t, std::allocator&lt;operation_t&gt; &gt;::_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&lt;operation_t, std::allocator&lt;operation_t&gt; &gt;::_M_create_nodes(operation_t**, operation_t**)in libSkeleton.a(ControlScene.o)
  
  
        std::_Deque_base&lt;operation_t, std::allocator&lt;operation_t&gt; &gt;::_M_initialize_map(unsigned long)in libSkeleton.a(ControlScene.o)
  
  
  ld: symbol(s) not found
  
  
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>If anybody could offer some insight as to why these problems are occuring, I'd appreciate it.</p>