On 31 Jan 2012, at 1:31 PM, Howard Moon wrote: > I'd like to add the ability to support Cocoa, by adding a .mm/.h file > with the Cocoa code to display an NSAlert, and call it from here when the > preprocessor symbol MAC_COCOA is defined. I've created the Cocoa files, but > how can I include and call into that code from my .cpp file? Simply adding > either #import or #include of my new .h file causes many many errors, even > though the .mm file itself compiles fine.
I take it that the .h file has Objective-C directives and keywords? That'll never #include cleanly in C++. Can you make a C++-compatible .h file that contains only the declarations of your bridging functions, set off with extern "C"{}? (The extern would itself have to be guarded by #ifdef __cplusplus.) — F _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com