重命名 XCode 5.1 项目后出现编译器错误

Posted

技术标签:

【中文标题】重命名 XCode 5.1 项目后出现编译器错误【英文标题】:Compiler error after renaming XCode 5.1 project 【发布时间】:2014-07-09 18:29:51 【问题描述】:

我在 XCode 中将一个项目文件从 TopPlaces 重命名为 TopRegions。重命名并清理文件位置和引用后,我可以在 XCode 中“清理”文件而没有任何麻烦,但是当我去编译它时,我得到以下错误。

clang: error: no such file or directory: '/Users/iosPadawan/Documents/Developer/Stanford iOS 7/TopRegions/TopPlaces/ImageVC.m'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

我尝试删除错误中引用的视图控制器并从原始(预重命名)项目中重新导入它,但这并没有解决错误。

我在 TopPlaces 中对项目的“构建设置”和“构建阶段”进行了文本搜索,但结果一无所获。但是,在 Build Settings 中的 Compile Sources 下,我看到了对旧项目名称的引用(不在文本搜索中出现)。我已经尝试删除它们并重新添加实现文件,但我仍然遇到同样的错误。

我知道我错过了一些非常讨厌的东西,但我不知道是什么?有什么建议么?以下是编译器错误的完整列表:

CompileC /Users/iOSPadawan/Library/Developer/Xcode/DerivedData/TopRegions-euvbevtdsgmfzsbsgnulbhzytzij/Build/Intermediates/TopRegions.build/Debug-iphonesimulator/TopRegions.build/Objects-normal/i386/ImageVC.o TopPlaces/ImageVC.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd "/Users/iOSPadawan/Documents/Developer/Stanford iOS 7/TopRegions"
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/iOSPadawan/Library/Developer/Xcode/DerivedData/ModuleCache -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -fexceptions -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch -mios-simulator-version-min=7.0 -iquote /Users/iOSPadawan/Library/Developer/Xcode/DerivedData/TopRegions-euvbevtdsgmfzsbsgnulbhzytzij/Build/Intermediates/TopRegions.build/Debug-iphonesimulator/TopRegions.build/TopRegions-generated-files.hmap -I/Users/iOSPadawan/Library/Developer/Xcode/DerivedData/TopRegions-euvbevtdsgmfzsbsgnulbhzytzij/Build/Intermediates/TopRegions.build/Debug-iphonesimulator/TopRegions.build/TopRegions-own-target-headers.hmap -I/Users/iOSPadawan/Library/Developer/Xcode/DerivedData/TopRegions-euvbevtdsgmfzsbsgnulbhzytzij/Build/Intermediates/TopRegions.build/Debug-iphonesimulator/TopRegions.build/TopRegions-all-target-headers.hmap -iquote /Users/iOSPadawan/Library/Developer/Xcode/DerivedData/TopRegions-euvbevtdsgmfzsbsgnulbhzytzij/Build/Intermediates/TopRegions.build/Debug-iphonesimulator/TopRegions.build/TopRegions-project-headers.hmap -I/Users/iOSPadawan/Library/Developer/Xcode/DerivedData/TopRegions-euvbevtdsgmfzsbsgnulbhzytzij/Build/Products/Debug-iphonesimulator/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/iOSPadawan/Library/Developer/Xcode/DerivedData/TopRegions-euvbevtdsgmfzsbsgnulbhzytzij/Build/Intermediates/TopRegions.build/Debug-iphonesimulator/TopRegions.build/DerivedSources/i386 -I/Users/iOSPadawan/Library/Developer/Xcode/DerivedData/TopRegions-euvbevtdsgmfzsbsgnulbhzytzij/Build/Intermediates/TopRegions.build/Debug-iphonesimulator/TopRegions.build/DerivedSources -F/Users/iOSPadawan/Library/Developer/Xcode/DerivedData/TopRegions-euvbevtdsgmfzsbsgnulbhzytzij/Build/Products/Debug-iphonesimulator -include /Users/iOSPadawan/Library/Developer/Xcode/DerivedData/TopRegions-euvbevtdsgmfzsbsgnulbhzytzij/Build/Intermediates/PrecompiledHeaders/TopRegions-Prefix-gvxkjoatgnwponegpmitcljtrjli/TopRegions-Prefix.pch -MMD -MT dependencies -MF /Users/iOSPadawan/Library/Developer/Xcode/DerivedData/TopRegions-euvbevtdsgmfzsbsgnulbhzytzij/Build/Intermediates/TopRegions.build/Debug-iphonesimulator/TopRegions.build/Objects-normal/i386/ImageVC.d --serialize-diagnostics /Users/iOSPadawan/Library/Developer/Xcode/DerivedData/TopRegions-euvbevtdsgmfzsbsgnulbhzytzij/Build/Intermediates/TopRegions.build/Debug-iphonesimulator/TopRegions.build/Objects-normal/i386/ImageVC.dia -c /Users/iOSPadawan/Documents/Developer/Stanford\ iOS\ 7/TopRegions/TopPlaces/ImageVC.m -o /Users/iOSPadawan/Library/Developer/Xcode/DerivedData/TopRegions-euvbevtdsgmfzsbsgnulbhzytzij/Build/Intermediates/TopRegions.build/Debug-iphonesimulator/TopRegions.build/Objects-normal/i386/ImageVC.o

【问题讨论】:

【参考方案1】:

由于我不明白的原因,编译器没有更新新项目名称的来源,尽管我在文件检查器中更新了它们的位置。我能够通过在项目导航器中删除引用(不是文件)并从 Finder 中将它们拖回来解决问题。

“经验只是人们给他们的错误起的名字。” ——奥斯卡·王尔德

【讨论】:

以上是关于重命名 XCode 5.1 项目后出现编译器错误的主要内容,如果未能解决你的问题,请参考以下文章

重命名项目/工作区后,出现多个“未声明的标识符”错误——但构建良好

重命名 Visual Studio 2008 MFC 项目后出现 R6034 运行时错误

重命名用户文件夹后 Xcode 存档错误

Xcode,我如何完全重命名一个项目?

iphone 项目 - 在 xcode 4.3 中复制和重命名

重命名项目Xcode后显示红色的新项目名称和未显示的文件