Re: Problem with compiler directives
Re: Problem with compiler directives
- Subject: Re: Problem with compiler directives
- From: Christiaan Hofman <email@hidden>
- Date: Fri, 01 Apr 2011 11:31:46 +0200
On Apr 1, 2011, at 10:11, Laurent Daudelin wrote:
> On Apr 1, 2011, at 00:34, Robert Purves wrote:
>
>>
>> Laurent Daudelin wrote:
>>
>>> In my deployment configuration, I have the SDKROOT defined with a build setting condition:
>>>
>>> x86_64 = macosx10.6
>>> i386 = macosx10.5
>>> ppc = macosx10.5
>>>
>>> Now, when I build and omit the <NSToolbarDelegate>, when the compiler compiles the x86_64, it complains with a warning that my ToolbarController doesn't implement protocol "NSToolbarDelegate".
>>>
>>> So, to get around this annoying warning, I did this in my ToolbarController.h file:
>>>
>>> #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
>>> @interface ToolbarController : NSObject <NSToolbarDelegate>
>>> #else
>>> @interface ToolbarController : NSObject
>>> #endif
>>>
>>> I'm obviously missing something because when the compiler compiles the ppc binary, it gives me an error that it can't find protocol NSToolbarDelegate:
>>
>> Try:
>>
>> #if defined MAC_OS_X_VERSION_10_6 && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
>>
>> Robert P.
>>
>
> Robert,
>
> That did the trick! I guess that's because the MAC_OS_X_VERSION_10_6 is not defined under the 10.5 SDK. Forgot that :-/
>
> Thanks!
>
> -Laurent.
> --
> Laurent Daudelin
> AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/
> Logiciels Nemesys Software email@hidden
Or check against 10_5 instead of 10_6.
BTW, I personally think it's easier to just declare empty protocols when using the 10.5 SDK, for instance in the precompile header.
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
@protocol NSToolbarDelegate <NSObject> @end
...
#endif
This has the advantage that you have to do this stuff only in one place, and when in the future you drop 10.5 (which you will), you don't have to change almost every single object header.
Christiaan
_______________________________________________
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