XCode PCH错误

时间:2010-09-29 11:17:56

标签: objective-c xcode build-error pch

据我所知,以前没有问过这个问题。我正在构建一个可可触摸静态库,直到昨天我一直都很顺利,在我将项目检入SVN后,它不再构建,我的PCH中有36个错误。这就是我的PCH,我过去没有发现任何问题:

//
// Prefix header for all source files of the 'CocoaTouchStaticLibrary' target in the 'CocoaTouchStaticLibrary' project.
//

#ifdef __OBJC__
    #import <Foundation/Foundation.h>
#endif

我得到了这些错误:

Build MYPROJECT of project MYPROJECT with configuration Release
ProcessPCH /var/folders/rQ/rQtcY0wvHECcTKEGF6D4hk+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/MYPROJECTPrefix-agsnbtjqunzmxwghwaudmojjbbgk/MYPROJECT_Prefix.pch.gch MYPROJECT_Prefix.pch normal i386 objective-c com.apple.compilers.gcc.4_2
cd /Users/rross/Documents/MYPROJECT
setenv LANG en_US.US-ASCII
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -x objective-c-header -arch i386 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -Os -Wreturn-type -Wunused-variable -D__IPHONE_OS_VERSION_MIN_REQUIRED=30200 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk -mmacosx-version-min=10.6 -gdwarf-2 -fobjc-abi-version=2 -fobjc-legacy-dispatch -iquote /Users/rross/Documents/MYPROJECT-iOS/build/MYPROJECT.build/Release-iphonesimulator/MYPROJECT.build/-generated-files.hmap -I/Users/rross/Documents/MYPROJECT/build/MYPROJECT.build/Release-iphonesimulator/MYPROJECT.build/-own-target-headers.hmap -I/Users/rross/Documents/MYPROJECT/build/MYPROJECT.build/Release-iphonesimulator/MYPROJECT.build/-all-target-headers.hmap -iquote /Users/rross/Documents/MYPROJECT/build/MYPROJECT.build/Release-iphonesimulator/MYPROJECT.build/-project-headers.hmap -F/Users/rross/Documents/MYPROJECT/build/Release-iphonesimulator -I/Users/rross/Documents/MYPROJECT/build/Release-iphonesimulator/include -I/Users/rross/Documents/MYPROJECT/build/MYPROJECT.build/Release-iphonesimulator/MYPROJECT.build/DerivedSources/i386 -I/Users/rross/Documents/MYPROJECT/build/MYPROJECT.build/Release-iphonesimulator/MYPROJECT.build/DerivedSources -c /Users/rross/Documents/MYPROJECT/_Prefix.pch -o /var/folders/rQ/rQtcY0wvHECcTKEGF6D4hk+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/_Prefix-agsnbtjqunzmxwghwaudmojjbbgk/_Prefix.pch.gch

In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:9,
                 from /Users/rross/Documents/MYPROJECT/src/ross/util/../ui/Comparable.h:9,
                 from /Users/rross/Documents/MYPROJECT/src/ross/datatype/Time.h:11,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:26,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
                 from /Users/rross/Documents/MYPROJECT/_Prefix.pch:6:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:16: error: cannot find interface declaration for 'NSObject', superclass of 'UIAcceleration'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:18: error: expected specifier-qualifier-list before 'NSTimeInterval'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:22: error: expected specifier-qualifier-list before 'NSTimeInterval'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:29: error: cannot find interface declaration for 'NSObject', superclass of 'UIAccelerometer'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:31: error: expected specifier-qualifier-list before 'NSTimeInterval'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:41: error: expected specifier-qualifier-list before 'NSTimeInterval'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:46: error: cannot find protocol declaration for 'NSObject'
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibility.h:14,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:10,
                 from /Users/rross/Documents/MYPROJECT/src/ross/util/../ui/Comparable.h:9,
                 from /Users/rross/Documents/MYPROJECT/src/ross/datatype/Time.h:11,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:26,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
                 from /Users/rross/Documents/MYPROJECT/_Prefix.pch:6:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityElement.h:22: error: cannot find interface declaration for 'NSObject', superclass of 'UIAccessibilityElement'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityElement.h:31: error: expected specifier-qualifier-list before 'BOOL'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityElement.h:32: error: expected specifier-qualifier-list before 'NSString'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityElement.h:33: error: expected specifier-qualifier-list before 'NSString'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityElement.h:34: error: expected specifier-qualifier-list before 'NSString'
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:10,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:9,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h:10,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityAdditions.h:12,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibility.h:15,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:10,
                 from /Users/rross/Documents/MYPROJECT/src/ross/util/../ui/Comparable.h:9,
                 from /Users/rross/Documents/MYPROJECT/src/ross/datatype/Time.h:11,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:26,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
                 from /Users/rross/Documents/MYPROJECT/_Prefix.pch:6:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h:41: error: cannot find interface declaration for 'NSObject', superclass of 'UIEvent'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h:43: error: expected specifier-qualifier-list before 'NSTimeInterval'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h:49: error: expected specifier-qualifier-list before 'NSTimeInterval'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h:51: error: expected ')' before 'NSSet'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h:52: error: expected ')' before 'NSSet'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h:53: error: expected ')' before 'NSSet'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h:54: error: expected ')' before 'NSSet'
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:9,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h:10,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityAdditions.h:12,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibility.h:15,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:10,
                 from /Users/rross/Documents/MYPROJECT/src/ross/util/../ui/Comparable.h:9,
                 from /Users/rross/Documents/MYPROJECT/src/ross/datatype/Time.h:11,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:26,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
                 from /Users/rross/Documents/MYPROJECT/_Prefix.pch:6:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:12: error: cannot find interface declaration for 'NSObject', superclass of 'UIResponder'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:18: error: expected ')' before 'BOOL'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:19: error: expected ')' before 'BOOL'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:21: error: expected ')' before 'BOOL'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:22: error: expected ')' before 'BOOL'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:24: error: expected ')' before 'BOOL'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:31: error: expected ')' before 'NSSet'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:32: error: expected ')' before 'NSSet'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:33: error: expected ')' before 'NSSet'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:34: error: expected ')' before 'NSSet'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:42: error: expected ')' before 'BOOL'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:42: error: expected ')' before 'SEL'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:43: error: expected specifier-qualifier-list before 'NSUndoManager'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIResponder.h:49: error: cannot find interface declaration for 'NSObject'

夫妻俩:

  1. 我没有使用UIKit框架,为什么会出现与uikit相关的错误?

  2. 抱歉MYPROJECT垃圾,但项目现在是保密的。

  3. 提前谢谢大家

1 个答案:

答案 0 :(得分:3)

试试这个,也许有帮助

#import <Availability.h>

#ifdef __OBJC__
    #import <Foundation/Foundation.h>
    #import <UIKit/UIKit.h>
#endif

我还建议您完成所有可能的清洁项目,并确保选择了正确/现有的SDK。