xcode “ld: library not found for -lXYZ”是什么意思?有哪些不同的可能性?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11465676/
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
"ld: library not found for -lXYZ" means what? What are the different possibilites?
提问by Vaibhav Tekam
What are the different possibilities when this error can occur? What are the things one should look out for, in order to get rid of this?
发生此错误时有哪些不同的可能性?为了摆脱这种情况,应该注意什么?
What if XYZ is an static library directly added to project?
如果 XYZ 是直接添加到项目中的静态库怎么办?
回答by Lvsti
It means you are trying to link to a library which is not found by the system. In your case that appears to be a simple static library. You should check the following:
这意味着您正在尝试链接到系统未找到的库。在您的情况下,这似乎是一个简单的静态库。您应该检查以下内容:
- Look for the corresponding item in red among your project files, with special attention to the Frameworks group (that's where people normally put libraries). If you find one, fix the path or just remove and re-add the library manually.
- Repeat this in the Link Binary with Libraries entry under the Build Phases tab in the project/target settings.
- Check the Library Search Paths entry in the Build Settings tab in project/target settings. Make sure the path to your
libXYZ.a
file is listed there.
- 在您的项目文件中查找相应的红色项目,特别注意 Frameworks 组(这是人们通常放置库的地方)。如果找到,请修复路径或手动删除并重新添加库。
- 在项目/目标设置中 Build Phases 选项卡下的 Link Binary with Libraries 条目中重复此操作。
- 检查项目/目标设置中构建设置选项卡中的库搜索路径条目。确保您的
libXYZ.a
文件的路径在那里列出。