Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I need clarification on limitations of integrating C++ with Obj C



On 3/21/06, John Draper <email@hidden> 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?

What do you mean by "NIB object"? If you mean an object instantiated
in a NIB or referenced by such an object, then I know of no such
restriction.

>
> 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,

Why would you do that? If a file includes C++ code, then it must
either be itself C++ or Objective-C++.

> 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.
>

The type of the header is irrelevant. When you #include it, the
compiler essentially just dumps the contents of the file into the
source code file at the point where the #include directive appeared;
regardless of what Xcode thinks the file is.

> Can someone on this list explain to me what's going on?  Is there a fix....

--
Clark S. Cox III
email@hidden
My CV/Resume:
http://homepage.mac.com/clarkcox3/files/Resume.pdf
http://homepage.mac.com/clarkcox3/files/Resume.html
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden

References: 
 >I need clarification on limitations of integrating C++ with Obj C (From: John Draper <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.