• 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: to include a C++ class in proj
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: to include a C++ class in proj


  • Subject: Re: to include a C++ class in proj
  • From: Nick Rogers <email@hidden>
  • Date: Thu, 27 Mar 2008 19:35:45 +0530


hi,
the semicolon is there. i've changed extension to .hh and .mm, still the same error.
Again what headers to include for a .hh file to be taken as a file declaring a C++ class?


Wishes,
Nick

On 27-Mar-08, at 7:28 PM, Jens Miltner wrote:


Am 27.03.2008 um 14:44 schrieb Nick Rogers:
are we allowed to do that in a cocoa proj.
if so how do we declare the class.

Is it like?

class MyClass
{

}

this is throwing error at the first line: parse error before 'MyClass' token
what headers do i need to include for a C++ class?

Make sure your source file is compiled as Objective-C++. The easiest way is to give the file a '.mm' extension. Alternatively, you can change the file type in the inspector panel for the source file, but I prefer to indicate the language by file extension - it saves me a lot of headaches why things work different than expected ;-)


Also, your declaration above is missing a trailing semicolon - I guess that's not the issue here, but I have seen strange apparently out-of-location error messages when gcc gets confused due to missing semicolons...

HTH,
</jum>



_______________________________________________

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: to include a C++ class in proj
      • From: Brady Duga <email@hidden>
    • Re: to include a C++ class in proj
      • From: Scott Ribe <email@hidden>
References: 
 >to include a C++ class in proj (From: Nick Rogers <email@hidden>)
 >Re: to include a C++ class in proj (From: Jens Miltner <email@hidden>)

  • Prev by Date: Re: Getting other application window reference
  • Next by Date: Re: to include a C++ class in proj
  • Previous by thread: Re: to include a C++ class in proj
  • Next by thread: Re: to include a C++ class in proj
  • Index(es):
    • Date
    • Thread