How do I enable Objective-C++ use in Xcode 1.5?

Aleran

Registered
I want to mix C++ and Objective-C and heard Xcode supports this through Objective-C++. developer.apple.com has very little help on how I go about doing this. I found some example code they have, but when I just put it in a file with a .mm extension I still can't use the objects. It just seems to not like me mixing Objective-C and C++. How do I set my project to work in Objective-C++?

Thanks.
 
Your description is not very clear. What problems are you having and how can't you use the objects? One thing to keep in mind is that you cannot inherit a C++ class from an Objective-C one and vise versa.
 
I have looked at that page. In fact I have that exact code they've written and the thing just wont compile when ever I try to import the HelloWorld.mm file. I get parse errors pretty much whenever I use the word "class" I got these same errors when I was trying to do this on my own (meaning before I tried using apples HelloWorld code as a start).

Does anyone have a very basic step by step process of creating a project that can run C++ and Objective-C? If you can give me that, it should be enough to get me started and on my way.
 
Here's a project I just created real fast for you. It's extremely simple. It has a Controller class with an IBAction for a button. When the button gets clicked, it creates an instance of the Message C++ class and calls it's ShowMessage() method passing in a string (the method takes a parameter of type "string" - requires you to include iostream and string libraries. If you have any questions email me kainjow at kainjow dot com.

http://www.kainjow.com/code/CPlusPlusAndObjC.tar.gz
 
Thanks a lot! I'm downloading it now and will check it out.

EDIT: Yep it all ran and compiled fine. I'm not sure why mine wasn't working but from here I can experiment and figure out what went wrong. Thanks again.
 
Back
Top