我試圖編譯iPhone模擬器一些代碼,但我得到這個錯誤:爲iPhone模擬器編譯錯誤
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -O3 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk -Os -O3 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk -Os -x objective-c -I../../include -c version.c
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:29,
from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:14,
from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:80,
from version.c:11:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecKey.h:166: error: expected declaration specifiers or ‘...’ before ‘SecPadding’
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecKey.h:196: error: expected declaration specifiers or ‘...’ before ‘SecPadding’
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecKey.h:228: error: expected declaration specifiers or ‘...’ before ‘SecPadding’
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecKey.h:257: error: expected declaration specifiers or ‘...’ before ‘SecPadding’
make: *** [version.o] Error 1
但是,如果我編譯實際的iphone,它工作正常:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -O3 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk -arch armv6 -Os -O3 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk -arch armv6 -Os -x objective-c -I../../include -c version.c
發生此問題與文件一樣簡單只是包括Foundation.h沒有其他代碼:
#import <Foundation/Foundation.h>
關於這是關於什麼的想法?奇怪的是,我預計這會失敗的iPhone和模擬器。
編輯:fyi,我沒有使用XCode。這是一個使用Makefiles的大型多平臺項目。您在上面看到的命令是從Makefile中發出的。
不是說它在這個例子中有幫助,但是你知道你可以通過命令行來創建一個XCode項目嗎?請參閱http://stackoverflow.com/questions/377992/building-xcode-projects-from-the-command-line – 2009-10-27 17:24:21
感謝您的提示。但是,在這種情況下它沒有用,因爲我們只是使用Makefiles。 – paleozogt 2009-10-27 17:25:50