0

I'm working with a group of friends on a project, and we're doing it in Objective-C++, which I understand is just Objective-C with the ability to use C++ as well.

I'm curious how I'd go about creating a project like one of my friends has setup. They have a main.mm that runs everything important and starts the program up seemingly, where I'm using to the AppDelegate.m serving that purpose.

How do I get a project where it's just a .mm file that serves as the focal point, but still has all the Foundation properties like NSDate and whatnot? I don't want a UI, I just want command line input/output.

Doug Smith
  • 29,668
  • 57
  • 204
  • 388

2 Answers2

2

In Xcode, create a new project from the "OS X -> Command Line Tool" template and choose "Type: Foundation". Then rename "main.m" to "main.mm".

Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382
0

In Xcode File > New Project then select Application under OS X. Choose Command Line Tool and press next. Put in a name and make sure Type is set to Foundation.

Then you'll need to rename main.m to main.mm and link against the c++ std library. This answer describes how to add the std lib to the project.

Community
  • 1
  • 1
Lance
  • 8,872
  • 2
  • 36
  • 47
  • At least with the current Xcode, libc++ seems to be linked automatically if you have a main.mm file in your project. – Martin R Jan 14 '14 at 19:19