如何让 XCode4 找到 libgcov.a
我一直在构建一个静态库以在多个 iOS 项目之间共享,并且我想使用 gcov (或任何代码覆盖率分析工具)来告诉我哪里缺少测试。但是,当我按照以下说明启用 gcov 时: http://supermegaulttragroovy.com/blog/2005/11/03/unit-testing-and-code-coverage-with-xcode/
我从 Libtool 收到此错误:
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/libtool:无法找到文件:-lgcov /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/libtool: file: -lgcov 不是目标文件(库中不允许)
由于某种原因,XCode4 找不到 libgcov.a 文件。它位于我系统上的许多地方,但由于某种原因无法找到。我对 XCode 和基于 gcc 的编程相当陌生,所以我不确定如何解决这个问题,我的猜测是我只需要具体告诉它在哪里可以找到 libgcov.a 但我不确定该怎么做呢?
I've been building a static library to share between multiple iOS projects, and I want to use gcov (or any code coverage analysis tool) to tell me where I'm missing my tests. However, when I enable gcov by following these directions: http://supermegaultragroovy.com/blog/2005/11/03/unit-testing-and-code-coverage-with-xcode/
I get this error from Libtool:
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/libtool: can't locate file for: -lgcov /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/libtool: file: -lgcov is not an object file (not allowed in a library)
For some reason XCode4 can't find the libgcov.a file. It is in many places on my system but for some reason it can't be found. I'm fairly new to XCode, and gcc based programming in general, so I'm not sure how I can fix this, my guess is that I just have to tell it specifically where to find libgcov.a but I'm not sure how to go about that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来我找到了解决方案。疯狂的 XCode 在调用 gcc 时似乎对待静态库完全不同。我认为 MSBuild 是一个来自地狱的构建系统......它很简单,至少有关于它的书籍。
不管怎样,你可以这样做:
将
$(PLATFORM_DEVELOPER_USR_DIR)/lib
添加到静态库的“库搜索路径”构建设置中,并勾选“递归”复选框。对我有用,请告诉我是否对您有用。
Looks like I found a solution. Crazy XCode seems to treat static libraries completely different when invoking gcc. And I thought MSBuild was a build system from hell... it's a snap and at least there are books about it.
Anyway, here's how you do it:
Add
$(PLATFORM_DEVELOPER_USR_DIR)/lib
to your "Library Search Paths" build setting for your static library and tick the "Recursive" check box.Works for me, let me know if it works for you.
这可能有助于解决您的问题,请查看一下
GTM
This may help in solving your issue, have a look in to it
GTM