Thursday, 23 February 2012

Xcode 4: A C++ class template

Xcode 4 C++ users, rejoice!

It's really annoying that Xcode 4 has never shipped with a template for creating a new C++ class, with header and implementation file.

It lets you create objective C classes with header and implementation. But you always have to create a C++ header file in one step, and then the implementation in a second step.

And, honestly, why do those steps take so long to update the project?

It's not good enough, and so here's the answer...

The Xcode 4 C++ Class Template

I've created a super-simple to install C++ class template and installer.

Grab it on Github here.

Using it is a simple case of running a script and restarting Xcode. I've built in support for Xcode 4.2 and the new Xcode 4.3. The installer runs a number of sanity checks to make sure you're not about to install something dumb on your computer.

Full docs are in the README file up there.

I hope you find it useful. I know I do.

Making your life better, one class at a time...


rich e. said...

Thanks for this! I was about to make one myself but I haven't gotten around to learning how to do this is Xcode 4. Seems it got alot tougher since 3.

Are you sure that templates aren't recognized anywhere in the ~/Library area, like before?

Also, the script fails if you have both 4.2 and 4.3 installed (I have 4.3 installed but I don't use it since it sucks the cpu out of my computer when navigating heavily templated C++ code.

Unknown said...
This comment has been removed by the author.
Anonymous said...

Just what I was looking for, thanks!

jay paul said...

Very informative and well written post! I would suggest this blog to my friends also

Samsung - 11.6" Notebook 2 GB Memory and 64 GB Solid State Drive

Samsung - 15.6" Notebook 8 GB Memory - 500 GB Hard Drive