• 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: 'class' in .h file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'class' in .h file


  • Subject: Re: 'class' in .h file
  • From: Prachi Gauriar <email@hidden>
  • Date: Sat, 22 Nov 2003 14:23:26 -0600

On Nov 22, 2003, at 1:52 PM, OL&L Dev 2 wrote:

A.mm for a header file?

This will also break the compile on older versions of CodeWarrior as it maps .h to both C and C++ files and I need to leave it that was so that I can compile it with CodeWarrior's C++ compiler also. This is a .h file that I need to be able to compile on Classic, Carbon, and Cocoa. Why can't the Obj-C compiler handle 'class' in a .h file?

-m


Because Objective-C is a superset of C, not C++. A Cocoa/Objective-C application only allows for Objective-C by default. As such, to make it use a C++ file, you need to let the compiler know that the file is Objective-C++ so that the compiler can understands C++ and Objective C.

Don't change the name of the header. Just of the files that use the header. Give them .mm extensions so that the compiler explicitly understands that the files should be compiled as Objective-C++.

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

References: 
 >'class' in .h file (From: OL&L Dev 2 <email@hidden>)
 >Re: 'class' in .h file (From: Troy Dawson <email@hidden>)
 >Re: 'class' in .h file (From: OL&L Dev 2 <email@hidden>)

  • Prev by Date: Re: 'class' in .h file
  • Next by Date: Framework within Bundle
  • Previous by thread: Re: 'class' in .h file
  • Next by thread: Re: 'class' in .h file
  • Index(es):
    • Date
    • Thread