title: How do I convert a complex C++ XCode project to a Cocoa app?
body: <p>I have the source code to a relatively complex C++ application that involves lots of libraries, dependencies, etc.  I am trying to take it and add a Cocoa GUI to it.  I have failed so far at the following :</p>
  
  <ul>
  <li>Create a new Cocoa xcodeproj and try to move all the libraries, etc. into the Cocoa app.  I just can't get it to build.  Thousands of errors no matter what I do.  My skill here is just not good enough to figure out what's going on.</li>
  </ul>
  
  <p>So, I am thinking that an easier method must be to make the appropriate changes to the C++ xcodeproj in order to make the main() function launch an NSApplication instead of whatever it is doing right now.</p>
  
  <p>Does anyone know what I would have to do, precisely, to make this happen? I am new to Cocoa so I am unsure of what I would have to add.  For reference, the main.cpp of the C++ app is actually really simple:</p>
  
  <pre><code>int main() {
      ofSetupOpenGL(320,300, OF_WINDOW);
      ofRunApp(new testApp());
  }
  </code></pre>
  
  <p>What I'd like to do is make all the right changes so this can be:</p>
  
  <pre><code>#import &lt;Cocoa/Cocoa.h&gt;
  
  int main(int argc, char *argv[]) {
      return NSApplicationMain(argc,  (const char **) argv);
  }
  </code></pre>
  
  <p>And have the old xcodeproj compile with all the "stuff" still in it, and then when it is run, open up the Cocoa window.</p>
  
  <p>It should be noted that the C++ xcodeproj appears to have absolutely nothing Cocoa-related, or even Objective-C related in it, so we'll have to add everything that is relevant and make all relevant changes.</p>
  
  <p>Any ideas?</p>
  
  <p>(Or, alternatively, if you know how I might easily get all the stuff from the C++ xcodeproj to build in a squeaky clean Cocoa xcodeproj, let me know, but this seems more complex to me at the moment.)</p>
  
  <p>Thanks!</p>