• 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: Compile errors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compile errors


  • Subject: Re: Compile errors
  • From: Fritz Anderson <email@hidden>
  • Date: Fri, 27 Feb 2009 10:16:00 -0600

On 26 Feb 2009, at 10:19 PM, Barry Fawthrop wrote:

To Greg Thank for the input

I have asn1_encode.mm

and AppController.m

I changed this to AppController.mm and all worked fine ???

This is a result of the C++ name mangling Greg mentioned. C++ will take a simple-looking function name and translate (mangle) it into something more complex, encoding return and parameter types, for the purpose of storing the object code to be linked. C just puts an underscore in front of the function's name.


Changing the suffix from .m to .mm changed the semantics of function declarations so that function declarations point at the complex object- code name instead of the simple one. As the functions in question were defined in C++ (and not guarded by the 'extern "C"' declaration that suppresses mangling), they couldn't be found by the simple name. But .m files are built on the simpler C model, which pointed them at the simple name.

Look up "C++ mangling" to get a better feel; it's an issue that will come up repeatedly.

	– F

--
Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- <http://x3u.manoverboard.org/ >


_______________________________________________

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: 
 >Compile errors (From: Barry Fawthrop <email@hidden>)
 >Re: Compile errors (From: Greg Parker <email@hidden>)
 >Re: Compile errors (From: Barry Fawthrop <email@hidden>)

  • Prev by Date: Re: Why doesn't this work on my device?
  • Next by Date: Re: NSOutlineView - a way to adjust column widths without a header?
  • Previous by thread: Re: Compile errors
  • Next by thread: NSTextView very slow, any remedies?
  • Index(es):
    • Date
    • Thread