0

似乎有很多关于该错误消息的帖子,但我找不到与实际代码有关的帖子。我有一个名为 Xcode 4.0 的项目prog1,里面有一个文件main.m

#import <Foundation/Foundation.h>

@interface Fraction : NSObject
    -(void) print;
    -(void) setNumerator: (int) n;
    -(void) setDenominator: (int) d;
@end

@implementation Fraction {
    int numerator;
    int denominator;
}

-(void) print {
    NSLog(@"The fraction is %i/%i.", numerator, denominator);
}

-(void) setNumerator: (int) n {
    numerator = n;
}

-(void) setDenominator: (int) d {
    denominator = d;
}
@end

int main (int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    Fraction *f = [[Fraction alloc] init];
    [f setNumerator:5];
    [f setDenominator:6];
    [f print];

    [pool drain];
    return 0;
}

这是完整的错误信息:

ProcessPCH /Users/rh/Library/Developer/Xcode/DerivedData/prog1-djucagjboveiuwcnycgafzuugucf/Build/PrecompiledHeaders/prog1-Prefix-ethcjsncaxczlsgsnayacjarhmne/prog1-Prefix.pch.pth prog1/prog1-Prefix.pch normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/rh/Desktop/prog1/prog1
setenv LANG en_US.US-ASCII
/Developer/usr/bin/clang -x objective-c-header -arch x86_64 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -std=gnu99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wshorten-64-to-32 -DDEBUG -isysroot /Developer/SDKs/MacOSX10.6.sdk -fasm-blocks -mmacosx-version-min=10.6 -gdwarf-2 -iquote /Users/rh/Library/Developer/Xcode/DerivedData/prog1-djucagjboveiuwcnycgafzuugucf/Build/Intermediates/prog1.build/Debug/prog1.build/prog1-generated-files.hmap -I/Users/rh/Library/Developer/Xcode/DerivedData/prog1-djucagjboveiuwcnycgafzuugucf/Build/Intermediates/prog1.build/Debug/prog1.build/prog1-own-target-headers.hmap -I/Users/rh/Library/Developer/Xcode/DerivedData/prog1-djucagjboveiuwcnycgafzuugucf/Build/Intermediates/prog1.build/Debug/prog1.build/prog1-all-target-headers.hmap -iquote /Users/rh/Library/Developer/Xcode/DerivedData/prog1-djucagjboveiuwcnycgafzuugucf/Build/Intermediates/prog1.build/Debug/prog1.build/prog1-project-headers.hmap -I/Users/rh/Library/Developer/Xcode/DerivedData/prog1-djucagjboveiuwcnycgafzuugucf/Build/Products/Debug/include -I/Users/rh/Library/Developer/Xcode/DerivedData/prog1-djucagjboveiuwcnycgafzuugucf/Build/Intermediates/prog1.build/Debug/prog1.build/DerivedSources/x86_64 -I/Users/rh/Library/Developer/Xcode/DerivedData/prog1-djucagjboveiuwcnycgafzuugucf/Build/Intermediates/prog1.build/Debug/prog1.build/DerivedSources -F/Users/rh/Library/Developer/Xcode/DerivedData/prog1-djucagjboveiuwcnycgafzuugucf/Build/Products/Debug -c /Users/rh/Desktop/prog1/prog1/prog1/prog1-Prefix.pch -o /Users/rh/Library/Developer/Xcode/DerivedData/prog1-djucagjboveiuwcnycgafzuugucf/Build/PrecompiledHeaders/prog1-Prefix-ethcjsncaxczlsgsnayacjarhmne/prog1-Prefix.pch.pth

clang: error: no such file or directory: '/Users/rh/Desktop/prog1/prog1/prog1/prog1-Prefix.pch'
clang: error: no input files
Command /Developer/usr/bin/clang failed with exit code 1

我在这里没有发现任何问题,但是我又开始学习 Objective-C。帮助?

4

1 回答 1

0

为了结束这个问题,我将引用 Till 的评论,他懒得写作为答案。:)

“该文件称为预编译头文件。您可以通过在 Xcode 的构建设置中停用预编译头文件来解决问题。”

于 2012-08-20T09:09:25.567 回答