我是mac編程的初學者。我嘗試使用Gestalt函數,所以我導入了CoreService/CoreService.h。但是我的雪豹xcode 4.2無法找到CoreService框架中包含的CarbonCore框架。我的代碼是這樣的:xcode無法在coreservice中找到carboncore框架
#import "AppDelegate.h"
#import <CoreServices/CoreServices.h>
@implementation AppDelegate
@synthesize window = _window;
- (void)dealloc
{
[super dealloc];
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
SInt32 majorver, minorver, bugfixver;
Getstalt(gestaltSystemVersionMajor, &majorver);
Getstalt(gestaltSystemVersionMinor, &minorver);
Getstalt(gestaltSystemVersionBugFix, &bugfixver);
}
@end
但建設將失敗,並警告:
Implicit declaration of function 'Getstalt' is invalid in C99
和一個錯誤:
Undefined symbols for architecture x86_64:
"_Getstalt", referenced from:
-[AppDelegate applicationDidFinishLaunching:] in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
當我走進CoreService.h在Xcode中,我發現xcode可以找到除CoreCore和CoreFoundation之外的CoreService的所有子框架。我去檢查文件系統,發現所有這些頭文件都在/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers
,所以我完全不知道爲什麼CarbonCore不能被xcode檢測到,以及爲什麼其他框架都可以。
我該怎麼做才能讓CarbonCore框架發揮作用?