But the error when compiling is "parse error before & token".
Is passing by reference not allowed or is there any other syntax that I should follow?

References are a C++ feature.

Objective C++ works just fine, but you need to compile as Objective C++ by using an extension of .mm.

Since this is a pain, what I typically do is simply set the GCC 4.0 Language preferences to compile everything as Objective C++. Note that I changed this for Keyboard Maestro some versions back and I did a few tests and basically found no noticeable change in size or performance. I've also done this for an iPhone app with the same results so I don't see any reason not to do this in general as C++ is in general a cleaner language (with more junk stuck on, but you can ignore that).

What I can't figure out is why Xcode iPhone projects do not display the GCC 4.0 Language section in the settings (inexplicably, the section has now appeared in my own iPhone project, but it does not show up in newly created projects - bizarre!

Anyway, the solution is:

Don't use C++ features.
Use .mm (for all files that import your header!)
Switch to Compile Sources As: Objective C++
   [GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp]

Enjoy,
   Peter.


--
              Keyboard Maestro 3 Now Available!
   Now run macros from your iPhone with Keyboard Maestro Control!

Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
<http://www.stairways.com/>           <http://download.stairways.com/>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to