【问题标题】:How to modify the command XCode uses for creating the precompiled header?如何修改 XCode 用于创建预编译头的命令?
【发布时间】:2011-03-16 21:17:12
【问题描述】:

我正在开发一个 iPhone 应用程序,在对我的代码进行了一些小的更改后,当我尝试构建时,当 XCode 尝试创建预编译头文件时,我突然收到以下构建错误:

i686-apple-darwin10-gcc-4.2.1: n: No such file or directory
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1


从构建日志中,我可以看到崩溃行如下:

ProcessPCH /var/folders/rM/rMuXVqLVH+8h38HuH1nVVU+++Tk/-Caches-/com.apple.Xcode.508/SharedPrecompiledHeaders/ProjectName_Prefix-gmsrnnethxkzvrgfurlstopfubtu/ProjectName_Prefix.pch.gch ProjectName_Prefix.pch normal i386 objective-c com.apple.compilers.gcc.4_2
cd ProjectDir
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 -O0 -Wreturn-type -Wunused-variable -DDEBUG -D__IPHONE_OS_VERSION_MIN_REQUIRED=30200 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk -fvisibility=hidden -mmacosx-version-min=10.6 -gdwarf-2 -fobjc-abi-version=2 -fobjc-legacy-dispatch -iquote ProjectDir/build/ProjectName.build/Debug-iphonesimulator/ProjectName.build/ProjectName-generated-files.hmap -IProjectDir/build/ProjectName.build/Debug-iphonesimulator/ProjectName.build/ProjectName-own-target-headers.hmap -IProjectDir/build/ProjectName.build/Debug-iphonesimulator/ProjectName.build/ProjectName-all-target-headers.hmap -iquote ProjectDir/build/ProjectName.build/Debug-iphonesimulator/ProjectName.build/ProjectName-project-headers.hmap -FProjectDir/build/Debug-iphonesimulator -I/ProjectDir/build/Debug-iphonesimulator/include -I../three20/Build/Products/three20 -IProjectDir/build/ProjectName.build/Debug-iphonesimulator/ProjectName.build/DerivedSources/i386 -IProjectDir/build/ProjectName.build/Debug-iphonesimulator/ProjectName.build/DerivedSources n -c ProjectDir/ProjectName_Prefix.pch -o /var/folders/rM/rMuXVqLVH+8h38HuH1nVVU+++Tk/-Caches-/com.apple.Xcode.508/SharedPrecompiledHeaders/ProjectName_Prefix-gmsrnnethxkzvrgfurlstopfubtu/ProjectName_Prefix.pch.gch

i686-apple-darwin10-gcc-4.2.1: n: No such file or directory Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1


由于某种原因,命令中间突然出现了术语“n” (... /DerivedSources n -c ...) ,据我所知,它确实不属于那里。

我尝试清空 XCode 缓存、清理项目、依赖项和预编译的头文件,但是在重建时我得到了同样的错误。

我还尝试恢复我在之前成功编译后所做的所有我能想到的更改,但没有运气。我还尝试重新安装 XCode (3.2.3),但没有成功。不过,其他项目似乎仍然可以正常编译。

这个“n”怎么可能突然出现在命令中,我有什么办法可以修改该行以使事情再次正常运行?

提前致谢!

【问题讨论】:

  • 我设法解决这个问题的唯一方法是创建一个全新的项目,并将之前项目中的所有源文件添加到其中。现在程序编译得很好,所以至少代码文件不会弄乱XCode。我仍然很好奇是什么导致了这整个问题,以及如果我将来遇到它应该如何解决它。

标签: objective-c xcode gcc


【解决方案1】:

您的项目文件类型有误。尝试打开项目文件找到它, vim yourproject.xcodeproj/project.pbproj

然后搜索“COMPILER_FLAGS =” /s COMPILER_FLAGS = "

如果搜索,您会看到在您的 xcode 项目中输入错误的文件。

【讨论】:

  • 感谢您的帮助。不幸的是,这是很久以前的事了,我不再在这个项目中工作。有问题的项目文件也不再存在,因为我创建了一个新项目来解决上面评论中所述的问题。
猜你喜欢
  • 2011-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-05
  • 2019-02-27
  • 2011-07-22
  • 1970-01-01
相关资源
最近更新 更多