Objective-C++

The Apple line for what do when combining Objective-C and C++ is to change the file extensions from .m to .mm. But in Apple examples they never seem to do this! Instead, in the Build Settings under “LLVM GCC  4.2 – Language” subheading “Compile Sources As” they choose the setting “Objective-C++”.  This seems to work much better, I added some working C++ from an Apple example and got a ton of errors, changing the file extensions to .mm I got less errors but still no build. Changing to “Objective-C++” and putting the file extension back to .m I got an error free build but 14 warnings. Better but still no prize.

This is intended mostly as a note to myself, but if it helps someone else great!

As an added note: The Warnings don’t show up on the Apple Example because they just turned them off! Also in Build Settings under “LLVM GCC 4.2 Warning” subheading “Missing Function Prototypes” they changed the default to “No”. So much for the general rule that “Warning” should be treated as “Errors”!

 

This entry was posted in General. Bookmark the permalink.

Leave a Reply