Xcode 从10.4迁移到10.8 SDK的未知类型
我有一个在Xcode 3.2.6和10.4u SDK上工作的老项目 将其移动到10.8 SDK和LLVM 5时,我得到了一些未知类型: 错误:Xcode 从10.4迁移到10.8 SDK的未知类型,xcode,macos,compiler-construction,llvm,typedef,Xcode,Macos,Compiler Construction,Llvm,Typedef,我有一个在Xcode 3.2.6和10.4u SDK上工作的老项目 将其移动到10.8 SDK和LLVM 5时,我得到了一些未知类型: 错误: Error: unknown type name 'Handle' typedef Handle OSMenuBar; // Handle to Mac Menu Bar ^ 代码如下: #if TARGET_OS_MAC typedef Handle OSMenuBar;
Error: unknown type name 'Handle'
typedef Handle OSMenuBar; // Handle to Mac Menu Bar
^
代码如下:
#if TARGET_OS_MAC
typedef Handle OSMenuBar; // Handle to Mac Menu Bar
typedef MenuRef OSMenu; // Opaque reference to Mac Menu
typedef WindowRef OSWindow; // Opaque reference to Mac Window
typedef Handle OSHandle; // Mac Handle
typedef ControlRef OSControl; // Opaque reference to Mac Control
typedef Ptr OSPtr; // Mac memory Ptr
typedef SInt16 OSFileRef; // Mac file reference number
typedef IconRef OSIconRef; // Mac IconRef
typedef FSVolumeRefNum OSVolume; // Mac volume ref num
typedef WindowClass OSWindowClass; // Mac WindowClass
typedef CGContextRef OSCGContextRef; // Mac Quartz context ref
typedef DataBrowserItemID OSDataBrowserItemID; // DataBrowser item id
typedef DataBrowserPropertyID OSDataBrowserPropertyID; // DataBrowser property id
typedef DataBrowserItemDataRef OSDataBrowserItemDataRef; // DataBrowserItemDataRef
#pragma warning "TODO -- No QuickDraw for what OS 10.5???"
typedef GrafPtr OSGraphicsPort; // Mac GrafPtr
typedef GWorldPtr OSImageList; // Mac GWorld containing images
typedef CIconHandle OSColorIcon; // Mac CIcon
typedef Handle OSIconSuite; // Mac Icon Suite Handle
typedef PicHandle OSPicture; // Mac Picture Handle
typedef RgnHandle OSRegion; // Mac Region
#endif
所有这些typedef似乎都会产生相同的未知类型错误
我如何才能最好地解决这个问题?看起来你有一个旧的碳项目——我相信10.8中的碳项目是不推荐的。事实上,这是一个旧的碳项目!那么这是否意味着只有10.7?需要一场远离碳编码的马拉松吗?这是否意味着我们必须开始使用Objective-C?目前我不确定您的选项是什么,但您可以先尝试将SDK设置为更早的版本-但我不确定当前版本的Xcode支持多久。请注意,Xcode 3.2.x仍然可以在OS x 10.8上正常工作(我仍然在旧项目中使用它),但是否仍可以在10.6和Xcode 3.2.6上运行,目标是104U或10.5 SDK,并且应用程序仍然在10.9上运行?由于该应用程序是在一个仍然有碳元素的平台上构建和链接的?我不确定-我猜碳元素应用程序仍然在10.8(?)上运行,所以只要你可以在旧SDK上构建,它就应该可以工作。我只能建议你试试看。