找不到选项的 Xcode 链接器目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9987292/
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-14 23:51:59  来源:igfitidea点击:

Xcode linker Directory not found for option

xcodexcode4

提问by huggie

Xcode 4 is throwing me a warning about directory not found for option '-L/Users/t2wu/Documents/blah blah'. Yes it shouldn't be found because I removed it. I remove the directory and I also removed the directory setting in both the target and the project library search path. I also remove the .a file which I was linking before from the "Link binaries with Libraries". It compiles fine, it just gives me the warning. Why is it still having the -L flag?

Xcode 4 向我发出警告,提示找不到选项“-L/Users/t2wu/Documents/blah blah”的目录。是的,它不应该被找到,因为我删除了它。我删除了目录,还删除了目标和项目库搜索路径中的目录设置。我还从“链接二进制文件与库”中删除了我之前链接的 .a 文件。它编译得很好,它只是给了我警告。为什么它仍然有 -L 标志?

回答by jkira

Check the Build settings tab and make sure that the "Library search paths" option is empty.

检查构建设置选项卡并确保“库搜索路径”选项为空。

At last resort, fire up Terminal and cd to the app project directory (appname.xcodeproj) and do a fgrep for the erroneous search path. I've found some of these lurking in the project.pbxproj file; ended up editing the file manually to get rid of them. (Of course you should make a copy of the file before doing so, in case you trash the project file.)

最后,启动终端并 cd 到应用程序项目目录 (appname.xcodeproj) 并为错误的搜索路径执行 fgrep。我发现其中一些潜伏在 project.pbxproj 文件中;最终手动编辑文件以摆脱它们。(当然,您应该在执行此操作之前制作该文件的副本,以防您将项目文件丢弃。)

It'd also be worthwhile to do a "clean" on the project. How to Empty Caches and Clean All Targets Xcode 4.

对项目进行“清理”也是值得的。如何清空缓存和清理所有目标 Xcode 4

回答by Anni S

I had the same issue in my project, it contains multiple custom framework created by me and the project. My issue is resolved by removing 'Framework search Paths' and 'Library Search Paths' from the target which has this issue.

我在我的项目中遇到了同样的问题,它包含由我和项目创建的多个自定义框架。通过从具有此问题的目标中删除“框架搜索路径”和“库搜索路径”来解决我的问题。

回答by Nikolay Shubenkov

In my case in targets -> build settings I removed searchpaths for which errors occured. Then removed libraries from project and added them again.

在我的情况下,目标 -> 构建设置我删除了发生错误的搜索路径。然后从项目中删除库并再次添加它们。

回答by robert

You may need to clear the Search Paths for the Tests target as well as the main project. This had me stumped for a little while.

您可能需要清除测试目标和主项目的搜索路径。这让我难住了一会儿。

回答by Castro Zwelithini

I checked the library search path I went to Build settings -> Search Paths change the "Framework Search Paths" to $(inherited)...that solved my problem

我检查了我转到构建设置的库搜索路径-> 搜索路径将“框架搜索路径”更改为 $(inherited)...这解决了我的问题

回答by Taiwosam

Sometimes, this error occurs if you open Project.xcodeprojinstead of Project.xcworkspace. Check your project directory and make sure to open Project.xcworkspace.

有时,如果您打开Project.xcodeproj而不是Project.xcworkspace. 检查您的项目目录并确保打开Project.xcworkspace.