• 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
Objective C++ from Objective C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Objective C++ from Objective C


  • Subject: Objective C++ from Objective C
  • From: James Trankelson <email@hidden>
  • Date: Tue, 3 Feb 2009 02:08:25 +0100

Hi,

For the majority of my OS X programming life, I've been using
Objective C exclusively. However, I now have a reason to want to use
some C++ standard template libraries, and have started looking into
Objective C++. I've found the documentation on Objective C++ lacking,
and was hoping if someone could just show me how I can accomplish the
following:

>From an Objective C class, allocate an object that can contain
references to C++ standard template libraries.

For example:

#include "OCPP_Class.h"

@implementation OC_Class

-(void) foo {
  OCPP_Class *bar = [[OCPP_Class alloc] init];
}

@end


@implementation OCPP_Class

-(id) init
{
  std::list<int> temp;
}

@end

When I try to compile this (with the latter compiled as
sourcecode.cpp.objcpp), the compiler complains about the reference in
the  OC_Class where I allocate my object. Something about the first
parameter being of the wrong pointer type.

While this sounds like something I might suspect with C++ trying to
send the this pointer, I have no idea how to get around this, or how
to fix it. Can anyone point me in the right direction?

Thanks.

-jim
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Objective C++ from Objective C
      • From: Peter N Lewis <email@hidden>
    • Re: Objective C++ from Objective C
      • From: Wayne Packard <email@hidden>
  • Prev by Date: Re: NSXMLParser and Unicode/"Foreign" Character problems
  • Next by Date: Re: Objective C++ from Objective C
  • Previous by thread: Re: EXC_BAD_ACCESS down inside [NSOutlineView reloadItem:reloadChildren];
  • Next by thread: Re: Objective C++ from Objective C
  • Index(es):
    • Date
    • Thread