Re: Obj-c and c++ in same file
Re: Obj-c and c++ in same file
- Subject: Re: Obj-c and c++ in same file
- From: Bob Clark <email@hidden>
- Date: Tue, 15 Mar 2005 09:27:36 -0800
On Mar 15, 2005, at 9:01 AM, Mark Thomas wrote:
Hi,
Does anybody know whether its possible to have both obj-c and C++ in
the
same source file, as I'm trying to pull in some of my utility class in
obj-c
code.
Is this possible. I have in the passedd created a straight C glue file,
where there's C functions which do the C++ work in a separate .cpp
file, but
I wondered if I can have both in a .m file.
Hi Mark.
James Dessart already pointed out that you can use a .mm file extension
or set up your project to force ObjC++.
(The latter is what I do, since I have some .cpp files with
Objective-C. In your target's info panel is "Compile Source As"...
change that to Objective-C++ and you're golden.)
One "gotcha" is that if you mix (some) C++ stuff in your headers
(passing by reference, for example, if I recall correctly) then
Interface Builder will have trouble parsing the headers. So if you can
keep your headers closer to "pure" Objective-C you'll have an easier
time in Interface Builder. I've had to split up header files into
separate "Interface Builder-friendly" and "raw C++" headers to get
around this problem.
--Bob
--
Bob Clark
Clarkwood Software, LLC
http://www.clarkwood.com/
Mac OS X Software
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden