• 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: NSObjCRuntime.h won't compile? Or .mm files?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSObjCRuntime.h won't compile? Or .mm files?


  • Subject: Re: NSObjCRuntime.h won't compile? Or .mm files?
  • From: Eric Albert <email@hidden>
  • Date: Wed, 21 Sep 2005 19:46:09 -0700

On Sep 21, 2005, at 3:16 PM, Bob Sabiston wrote:

    Sorry for all the questions.  I keep thinking it is almost through.
Xcode is trying to compile a .mm file I have in my project, it is some CoreImage stuff that uses Objective C, but this is overall a C++ application.  In Codewarrior this compiles fine, but Xcode is not having it.
I get this error in NSObjCRuntime,h:

<x-tad-smaller>System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:56: error: expected unqualified-id before '@' token</x-tad-smaller>

Caused by the following from that header file: 

@class NSString;

I actually don't include that .h file--I assume it is part of the #import <Cocoa/Cocoa.h> at the beginning of my file:

#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4

#import <Cocoa/Cocoa.h> 
#import <QuartzCore/QuartzCore.h>

Is there some trick to getting a .mm Objective C file to compile in Xcode?

Are you sure this is from an .mm file? This error occurs most frequently when you have a precompiled header that #imports <Cocoa/Cocoa.h> (or any other Obj-C header) but gets included for non-Objective-C code. To fix that, protect your #import of Cocoa/Cocoa.h like this:

#if __OBJC__
#import <Cocoa/Cocoa.h>
#endif

Hope this helps,
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

  • Follow-Ups:
    • Re: NSObjCRuntime.h won't compile? Or .mm files?
      • From: Bob Sabiston <email@hidden>
References: 
 >NSObjCRuntime.h won't compile? Or .mm files? (From: Bob Sabiston <email@hidden>)

  • Prev by Date: Re: linker error can't find -framework Kernel?
  • Next by Date: Re: good xcode book?
  • Previous by thread: Re: NSObjCRuntime.h won't compile? Or .mm files?
  • Next by thread: Re: NSObjCRuntime.h won't compile? Or .mm files?
  • Index(es):
    • Date
    • Thread