• 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: pragma for compiling as Obj-C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pragma for compiling as Obj-C++


  • Subject: Re: pragma for compiling as Obj-C++
  • From: Tommy Nordgren <email@hidden>
  • Date: Thu, 26 Feb 2009 15:45:59 +0100

One work around is to put the code in a file with a made-up suffix,
and then include it from one file with suffix .mm and one file with suffix .cpp
Then you choose which files to compile according to the target platform
On Feb 25, 2009, at 9:24 PM, Eric Johnson wrote:


Hi All,
I'm wondering if there is a pragma I can use to tell gcc to compile a file as Obj-C++ instead of C++. (I looked, but didn't find one.) Here's what I'd like to do:


// foo.h

#if MACOS
@class FooUI;
#endif

// stuff

// end file

// foo.cpp

#if MACOS
#pragma CompileAsObjC++
#endif

#include "foo.h"

// stuff

// end file

I want to use the extension ".cpp", so that I can use the file on Mac and Windows, but I need the file to be compiled as Objective-C+ +, since "foo.h" contains some objective-C syntax (that's #ifdef'd for Mac).

Thanks in advance,
Eric_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

---------------------------------
How many National Democrats does it take to change a light bulb?
108: 8 who smashes the rest of the light bulbs, and 100 to blame a zionist world conspiracy for the darkness
--------------------------
Tommy Nordgren
email@hidden




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >pragma for compiling as Obj-C++ (From: Eric Johnson <email@hidden>)

  • Prev by Date: How to (re)set DEVELOPER_SDK_DIR
  • Next by Date: Re: pragma for compiling as Obj-C++
  • Previous by thread: Re: pragma for compiling as Obj-C++
  • Next by thread: Re: pragma for compiling as Obj-C++
  • Index(es):
    • Date
    • Thread