objective-c 找不到 xcode 6 pch.file

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25840720/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 21:25:57  来源:igfitidea点击:

xcode 6 pch.file not found

objective-cxcodexcode6

提问by alex willrock

I load my project from xcode 5 to xcode 6 and see error myProject-prefix.pch is not found in myProjectTests, I add this file and see new error

我将我的项目从 xcode 5 加载到 xcode 6 并看到错误 myProject-prefix.pch is not found in myProjectTests,我添加了这个文件并看到了新错误

Ld /Users/willrock/Library/Developer/Xcode/DerivedData/Мобильныи?_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Products/Debug-iphonesimulator/Мобильныи?\ Extreme\ FitnessTests.xctest/Мобильныи?\ Extreme\ FitnessTests normal x86_64
cd /Users/willrock/Desktop/ExtremeFitness
export IPHONEOS_DEPLOYMENT_TARGET=7.1
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 -arch x86_64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -L/Users/willrock/Library/Developer/Xcode/DerivedData/Мобильныи?_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Products/Debug-iphonesimulator -F/Users/willrock/Library/Developer/Xcode/DerivedData/Мобильныи?_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/Developer/Library/Frameworks -filelist /Users/willrock/Library/Developer/Xcode/DerivedData/Мобильныи?_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Intermediates/Мобильныи?\ Extreme\ Fitness.build/Debug-iphonesimulator/Мобильныи?\ Extreme\ FitnessTests.build/Objects-normal/x86_64/Мобильныи?\ Extreme\ FitnessTests.LinkFileList -bundle_loader /Users/willrock/Library/Developer/Xcode/DerivedData/Мобильныи?_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Products/Debug-iphonesimulator/extreme_fitness.app/extreme_fitness -Xlinker -objc_abi_version -Xlinker 2 -framework XCTest -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework XCTest -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/willrock/Library/Developer/Xcode/DerivedData/Мобильныи?_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Intermediates/Мобильныи?\ Extreme\ Fitness.build/Debug-iphonesimulator/Мобильныи?\ Extreme\ FitnessTests.build/Objects-normal/x86_64/Мобильныи?\ Extreme\ FitnessTests_dependency_info.dat -o /Users/willrock/Library/Developer/Xcode/DerivedData/Мобильныи?_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Products/Debug-iphonesimulator/Мобильныи?\ Extreme\ FitnessTests.xctest/Мобильныи?\ Extreme\ FitnessTests

ld: file not found: /Users/willrock/Library/Developer/Xcode/DerivedData/Мобильныи?_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Products/Debug-iphonesimulator/extreme_fitness.app/extreme_fitness clang: error: linker command failed with exit code 1 (use -v to see invocation)

d: file not found: /Users/willrock/Library/Developer/Xcode/DerivedData/Мобильныи?_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Products/Debug-iphonesimulator/extreme_fitness.app/extreme_fitness clang: error: linker command failed with exit code 1 (use -v to see invocation)

if i load project see in xctest

如果我加载项目在 xctest 中看到

clang: error: no such file or directory: '/Users/willrock/Desktop/ExtremeFitness/extreme_fitness/extreme_fitness-Prefix.pch' clang: error: no input files Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

clang: error: no such file or directory: '/Users/willrock/Desktop/ExtremeFitness/extreme_fitness/extreme_fitness-Prefix.pch' clang: error: no input files Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

but in xcode 5 is work fine

但在 xcode 5 中工作正常

采纳答案by alex willrock

i solved it - in targets delete xctest target and it compiled

我解决了它 - 在目标中删除 xctest 目标并编译

回答by emotality

  1. Make new file: ?cmd+N
  2. iOS/Mac > Other > PCH File > YourProject-Prefix.pch.
  3. Make sure you display "All" and not "Basic". (Blue buttons)
  4. Project > Build Settings > Search: "Prefix Header".
  5. Under "Apple LLVM 7.0" you will get the Prefix Headerkey.
  6. Type file directory. e.g: "$(SRCROOT)/$(PROJECT_NAME)/ProjectName-Prefix.pch".
  7. Clean project: ?cmd+?shift+K
  8. Build project: ?cmd+B
  1. 制作新文件:?cmd+N
  2. iOS/Mac > 其他 > PCH 文件 > YourProject-Prefix.pch。
  3. 确保显示“全部”而不是“基本”。(蓝色按钮)
  4. 项目 > 构建设置 > 搜索:“前缀标题”。
  5. 在“Apple LLVM 7.0”下,您将获得Prefix Header键。
  6. 键入文件目录。例如:“$(SRCROOT)/$(PROJECT_NAME)/ProjectName-Prefix.pch”。
  7. 清理项目:?cmd+ ?shift+K
  8. 构建项目:?cmd+B


Prefix Header Image

前缀标题图像

回答by Deepak

Try this with Xcode 6. You need to manually create the PCH File.

用 Xcode 6 试试这个。您需要手动创建 PCH 文件。

File -> New -> File -> iOS -> C and C++ -> PCH File.

文件 -> 新建 -> 文件 -> iOS -> C 和 C++ -> PCH 文件。

Add new PCH file to the project - New file > Other > PCH file

向项目添加新的 PCH 文件 - 新建文件 > 其他 > PCH 文件

At the project 'Build Settings' option - set the value of 'Prefix Header' to your PCH file name, with the project name as prefix - i.e. for project named 'TestProject' and PCH file named 'MyPrefixHeaderFile', add the value 'TestProject/MyPrefixHeaderFile.pch' to the plist.

在项目“构建设置”选项中 - 将“Prefix Header”的值设置为您的 PCH 文件名,以项目名称作为前缀 - 即对于名为“TestProject”的项目和名为“MyPrefixHeaderFile”的 PCH 文件,添加值“TestProject” /MyPrefixHeaderFile.pch' 到 plist。

回答by Imran

There are a lot of reasons for this issue and I had my own hits.I had to do two steps for my project to run.May be it can be helpful for others.

这个问题有很多原因,我有自己的命中。我必须做两个步骤才能运行我的项目。也许它对其他人有帮助。

  1. I deleted the entry in the Prefix headerof Build Settings.
  1. 我删除了Build Settings的Prefix 标题中的条目。

Path-> Target> Build Settings > Prefix Header.

路径-> Target> Build Settings > Prefix Header.

  1. Deleted the Your Project Tests filein the Targets.

    screen shot for the second point.

  1. 删除了目标中的您的项目测试文件

    第二点的屏幕截图

Reference: http://www.buzztouch.com/forum/thread.php?tid=F42D8239A330C321132944A&currentPage=3

参考:http: //www.buzztouch.com/forum/thread.php?tid=F42D8239A330C321132944A& currentPage=3

回答by Anand Kr. Avasthi

Generate a new pch file. Name the file as Demo-Prefix.Pch Go to targets - Build Settingslike the screenshot problem solved exactly

生成一个新的 pch 文件。将文件命名为 Demo-Prefix.Pch 转到目标 - 构建设置就像截图问题完全解决了一样

回答by bruce

Do as follows, changing [Precompile Prefix Header] with [no] and [Prefix Header] with empty field.

执行如下操作,将 [Precompile Prefix Header] 更改为 [no],将 [Prefix Header] 更改为空字段。

And I rebuild the project, it passes, and runs!

我重建项目,它通过并运行!

[Project]
-[Basic]
-[Apple LLVM6.1-Language]
--[Precompile Prefix Header]-[no]
--[Prefix Header]--[]

回答by Dan

Here is a description what you should do

这是您应该做什么的说明

  1. Click on the first folder under the blue page with the project name. The folder with also have the project name next to it.

  2. File > New File > iOS > Other

  3. Click on PCH File

  4. Click Next

  5. Save As: PrefixHeader

  6. Click the first checkbox under TargetsONLY; if others are checked, uncheck them

  7. Click Create

  8. If the Prefix Header" file ended up in a different folder, such as the Supporting Filesfolder, move it up to the top folder you clicked on in step 1

  9. Click on the blue page at the top of the left sidebar with the project name next tot it. This is just above the folder you clicked on in step 1

  10. Click on the Build Settingstab

  11. In the search bar, type in, Prefix Headerand press the Return/Enterkey

  12. Look for Apple LLVM 6.0 or 7.0 - Language.6.0 refers to Xcode 6 and 7.0 refers to Xcode 7. This makes no difference.

  13. Make sure Increase Sharing of Precompiled Headersis set to Noand that Precompile Prefix Headeris set to No

  14. Find the Prefix Headerline just under the Precompile Prefix HeaderLine. Move the cursor over about 5 inches, but stay on the same line. Double-Click. A box will open.

  15. Type in the name of your project (this is stated next to the folder you clicked on in step 1)

    Example) Prereq for Overdue Assignment It is VERY IMPORTANT that you type in capitals where needed such as "P" in "Prereq." It is case sensitive.Now, put in forward slash (/). Then type in the name of the file you created in steps 2-7 (Again, this is Case Sensitive and you must put spaces where needed). I recommend that you leave the file as PrefixHeader(no spaces). After the filename, such as PrefixHeader, type in .pchALL lower case.

  16. The final result should look something like this:

    Prereq for Overdue Assignment/PrefixHeader.pch

  17. Now, click on the Productmenu (6 menus over from the file menu you clicked on in step 2). Then click on Clean

    You can bypass this step by holding command, shift, and Kat the same time.Once you get the message, Clean Succeeded,move on to step 18.

  18. Click on the Productmenu and go down to Build. Click on Build.

    You can bypass this step by holding commandand Bat the same time.You should get Build Completed.

  1. 单击带有项目名称的蓝页下的第一个文件夹。文件夹旁边还有项目名称。

  2. File > New File > iOS > Other

  3. 点击 PCH File

  4. 点击 Next

  5. 另存为: PrefixHeader

  6. 单击TargetsONLY下的第一个复选框;如果其他人被选中,取消选中它们

  7. 点击 Create

  8. 如果Prefix Header" 文件最终位于不同的文件夹中,例如Supporting Files文件夹,请将其向上移动到您在步骤 1 中单击的顶部文件夹

  9. 单击左侧边栏顶部的蓝页,旁边是项目名称。它位于您在步骤 1 中单击的文件夹上方

  10. 单击Build Settings选项卡

  11. 在搜索栏中输入,Prefix Header然后按Return/Enter

  12. 查找Apple LLVM 6.0 or 7.0 - Language.6.0 指的是 Xcode 6,而 7.0 指的是 Xcode 7。这没有区别。

  13. 确保Increase Sharing of Precompiled Headers设置为No并且Precompile Prefix Header设置为No

  14. 找到Prefix HeaderLine 正下方的Precompile Prefix Header那条线。将光标移动约 5 英寸,但保持在同一条线上。双击。一个盒子会打开。

  15. 输入您的项目名称(这在您在步骤 1 中单击的文件夹旁边说明)

    示例)逾期分配的先决条件 在需要的地方输入大写字母非常重要,例如“先决条件”中的“P”。它区分大小写。现在,输入正斜杠 ( /)。然后输入您在步骤 2-7 中创建的文件的名称(同样,这是区分大小写的,您必须在需要的地方放置空格)。我建议您将文件保留为PrefixHeader(无空格)。在文件名之后,例如PrefixHeader,输入.pch全部小写。

  16. 最终结果应该是这样的:

    Prereq for Overdue Assignment/PrefixHeader.pch

  17. 现在,单击Product菜单(您在步骤 2 中单击的文件菜单中的 6 个菜单)。然后点击Clean

    您可以通过按住跳过这一步commandshiftK在同一时间。收到消息后,Clean Succeeded,继续执行步骤 18。

  18. 单击Product菜单并向下转到Build。单击Build

    您可以通过同时按住command和来绕过此步骤B你应该得到Build Completed.

Thats it!

就是这样!

回答by Rana Raza

Just change your scheme name to what ever you want.Clear the project then compile it. Its working for me .

只需将您的方案名称更改为您想要的任何名称。清除项目然后编译它。它对我来说有效。

回答by Apoc

  • select your framework in the file navigator
  • open the utilities pane (Xcode -> View -> Utilities -> Show File Inspector)
  • enable target membership of your framework for all targets.
  • 在文件导航器中选择您的框架
  • 打开实用程序窗格(Xcode -> View -> Utilities -> Show File Inspector)
  • 为所有目标启用框架的目标成员资格。