• 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: Accessing C++ class method from ObjC++ code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing C++ class method from ObjC++ code


  • Subject: Re: Accessing C++ class method from ObjC++ code
  • From: "stephen joseph butler" <email@hidden>
  • Date: Sun, 18 Nov 2007 14:26:29 -0600

On Nov 18, 2007 1:50 PM, Charles Hamel <email@hidden> wrote:
> The definition is exactly the same,  I copied/pasted it just to be sure.

... and added 'Vision::', right? Many times this trips me up in C++. I
copy and paste the definition, but forget to add the class scope (and
then I get errors like you are).

> I understand the nature of the error, it really looks like somehow the
> linker doesn't see the analyze method implementation in Vision.mm,
> even if it is included in the target.

Do something crazy in the function, like
"call_method_doesnt_exist();". That way when you get the compile error
you can be 100% sure the file is being compiled.

> What I don't get is that AppController.mm compiles fine, it even
> highlights the vision->analyze(...) statement, so it knows it is a
> valid symbol right ?

Right... because it's in the header. But the error isn't from the
compiler (which would highlight invalid symbols) but from the linker
(which says the symbol doesn't map to any code).

> I have read the Apple doc many time now and I don't get what's
> missing, is there a way to force the linker with some kind of extern
> statement in my case ?

No... I'm not even sure what that's supposed to mean. Your class
definition already says that your function is external... that's the
whole purpose of class definitions and function prototypes! If the
linker can't find the implementation in its collection of object files
and dynamic libraries, then you have another problem.
_______________________________________________

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

References: 
 >Re: Accessing C++ class method from ObjC++ code (From: Scott Ribe <email@hidden>)
 >Re: Accessing C++ class method from ObjC++ code (From: Charles Hamel <email@hidden>)
 >Re: Accessing C++ class method from ObjC++ code (From: "stephen joseph butler" <email@hidden>)
 >Re: Accessing C++ class method from ObjC++ code (From: Charles Hamel <email@hidden>)
 >Re: Accessing C++ class method from ObjC++ code (From: "stephen joseph butler" <email@hidden>)
 >Re: Accessing C++ class method from ObjC++ code (From: Charles Hamel <email@hidden>)

  • Prev by Date: Re: Accessing C++ class method from ObjC++ code
  • Next by Date: Problems extending NSPersistentDocument Core Data Tutorial
  • Previous by thread: Re: Accessing C++ class method from ObjC++ code
  • Next by thread: Re: Accessing C++ class method from ObjC++ code
  • Index(es):
    • Date
    • Thread