• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Mixing Objective-C and C++ in Xcode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mixing Objective-C and C++ in Xcode


  • Subject: Re: Mixing Objective-C and C++ in Xcode
  • From: Steve Checkoway <email@hidden>
  • Date: Thu, 1 Jul 2004 18:14:33 -0700

On Jul 1, 2004, at 5:56 PM, Albion Baucom wrote:
UI front end. So at some point I have a Obj-C header including a C++
header so I can access methods and data in that C++ code via the Obj-C

You should likely be including the c++ header file from within the source file, not the Obj-C header. Also, any source file that is including the c++ header file needs to be compiled as c++ (or obj-c++).

Let's say you have:
foo.h
foo.cpp
bar.h
bar.m

and you want to use a class declared in foo in your bar.m. You should rename bar.m to bar.mm and bar.mm should #include "foo.h". bar.h Should not include foo.h, especially if it is going to be included by another objective-c source file. Otherwise that one would need to be .mm as well.

I hope that made any sense.

- Steve
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Mixing Objective-C and C++ in Xcode
      • From: Albion Baucom <email@hidden>
    • Re: Mixing Objective-C and C++ in Xcode
      • From: Scott Thompson <email@hidden>
References: 
 >Re: Mixing Objective-C and C++ in Xcode (From: Albion Baucom <email@hidden>)
 >Re: Mixing Objective-C and C++ in Xcode (From: Steve Checkoway <email@hidden>)

  • Prev by Date: md5 for Cocoa / Linker problems
  • Next by Date: Another Question: Mixing Objective-C and C++ in Xcode
  • Previous by thread: Re: Mixing Objective-C and C++ in Xcode
  • Next by thread: Re: Mixing Objective-C and C++ in Xcode
  • Index(es):
    • Date
    • Thread