again: problem with declaring a NSInteger

Rainer.Buerck's icon

Hi again,

I have added all the frameworks required by a Cocoa Application (AppKit.framework, Cocoa.framework, CoreData.framework, Foundation.framework) to my external, but when I try to declare a NSInteger;

NSInteger myNSInt

I receive an error: 'NSInteger' undeclared (first use in this function).

I can't explain this problem; especially because of the fact that I can use all other NS classes. Why not NSInteger?

Joshua Kit Clayton's icon

Chances are you are using the 10.4 SDK. configuring it to use the 10.5 SDK can be a pain, but perhaps Tim can shed light on this if necessary. Otherwise, you might be fine just using NSNumber.

-Joshua

Rainer.Buerck's icon

Well, I am using MaxSDK 5.0.6

Rainer

Joshua Kit Clayton's icon

I was referring to the OS SDK, for which NSInteger only exists in the 10.5 SDK or later. This is really a trivial typedef, and if you need it without using the 10.5 SDK or later, you can simply use the following:

#if __LP64__ || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef long NSInteger;
#else
typedef int NSInteger;
#endif