Re: I need clarification on limitations of integrating C++ with Obj C
Re: I need clarification on limitations of integrating C++ with Obj C
- Subject: Re: I need clarification on limitations of integrating C++ with Obj C
- From: Rush Manbert <email@hidden>
- Date: Tue, 21 Mar 2006 11:56:32 -0800
John Draper wrote:
Hi,
I'm trying to build an Obj C file... but it includes header files which are
C++ header files. If I set the source file type to sourcecode.cpp.objcpp
it compiles fine.
The only problem with that, is that I cannot make this object a NIB
object, because of the stupid restriction that NIB objects cannot
have any C++ code in it at all, but does that also mean the NIB
object cannot even include C++ files?
This object I call AudTransport does not have ANY C++ Calls or
references to C++ objects, but it does have a reference to
an Objective C Class which is kind of like a Bridge to bridge over
into a module that has both Objective C and C++ in it.
I call this the RTPSessionBridge, and it's a .mm file. Containing
both Objective C and C++.
Because the AudTransport has to reference an RTPSessionBridge object,
I'm forced to have to #include RTPSessionBridge.h and this one then
includes the C++ headers relating to the C++ calls it has to make.
Now, when I try and change the sourcecode file type of the AudTransport
into a pure Objective C file, I get more then 2221 errors... for instance
my first error is where it can't find a file deep within the C++ file where
it gags when it gets to.... #include <string>
The error I get is: string: no such file or directory...
The header files in each of the C++ files are of type 'sourcecode.cpp.h'
I tried changing them to other file types and nothing seems to work.
Can someone on this list explain to me what's going on? Is there a fix....
Hi John,
It sounds like you have some other problem. I have a project which is
organized in much the same way:
BrowseWindowController.m is pure Objective C, contains IBOutlet data
members, and is associated with a NIB file.
BrowseWindowController.h imports LibraryAdapter.h (the names have been
changed to protect the guilty), which is my bridge to my C++ static
library. LibraryAdapter is actually mixed Objective C and C++. The
header defines a C++ class that inherits from one of the library C++
classes. The LibraryAdapter.h includes LibraryApi.h, which is a pure C++
header file that defines an API class.
The only thing I have done to make this work, is to tell the project to
"Compile Sources As" Objective C++. Maybe you need to do this so that it
will search for standard library headers? (I don't know how this relates
to your source file types. I don't mess with those.)
Hope it helps,
Rush
_______________________________________________
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