简体   繁体   English

XCode PCH错误

[英]XCode PCH Errors

From what I can tell, this has not been asked before. 据我所知,这从未被问过。 I am building a cocoa touch static library and I have been going along fine until yesterday, right after I checked the project into SVN, it no longer builds and I have 36 errors in my PCH. 我正在构建一个可可触摸静态库,直到昨天,我将项目检入SVN之后,一直运行良好,它不再生成,并且PCH中存在36个错误。 This is all my PCH is, and I have found no problems with it in the past: 这就是我所有的PCH,过去我没有发现任何问题:

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

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

And I get these errors: 我得到这些错误:

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'

Couple things: 几件事情:

  1. I am not using the UIKit frameworks, so why is there uikit related errors? 我没有使用UIKit框架,那么为什么会有uikit相关的错误?

  2. Sorry about the MYPROJECT junk, but the project is confidential right now. 抱歉MYPROJECT的垃圾邮件,但该项目目前处于机密状态。

Thank you all in advance 谢谢大家

Try this, maybe helps 试试这个,也许有帮助

#import <Availability.h>

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

I also suggest you to do all the possible cleaning project stuff and making sure that you selected a correct/existing SDK. 我还建议您做所有可能的清洁项目工作,并确保选择了正确/现有的SDK。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM