Re: [SOLVED] C++ in a Cocoa App - How Hard is THAT?
Re: [SOLVED] C++ in a Cocoa App - How Hard is THAT?
- Subject: Re: [SOLVED] C++ in a Cocoa App - How Hard is THAT?
- From: Chris Hanson <email@hidden>
- Date: Sun, 9 Oct 2005 01:23:39 -0700
On Oct 8, 2005, at 10:20 AM, Lance Drake wrote:
Compiling the C++ file occurs entirely without incident - it was
including the C++ header file with 'class myObject {... }' in the
Objective-C header that caused all the commotion.
Yes, that will cause some issues. Generally you should use a minimum
set of include directives — no matter whether you're using Objective-
C, Objective-C++, or C++ — to help avoid some issues.
In other words, unless you actually need the full class declaration
for myObject above, don't include its header. Instead, just use a
forward declaration.
In the project 'style' settings I set "Compile Sources As" to be
'Objective-C++'. That was it. I KNEW it had to be something
simple - hence the query, "How hard is THAT?".
That's one solution, however, that means every C-derived source file
in your project -- whether it's a C, C++, Objective-C, or Objective-C+
+ file -- is compiled as Objective-C++. This may or may not be what
you want.
Often you may want to minimize the header/declaration overlap as I
describe above so you don't have to build your entire project as
Objective-C++.
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden