如何让 XCode4 找到 libgcov.a

发布于 2024-10-25 09:10:12 字数 719 浏览 5 评论 0原文

我一直在构建一个静态库以在多个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

欢烬 2024-11-01 09:10:12

看来我找到了解决方案。疯狂的 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.

层林尽染 2024-11-01 09:10:12

这可能有助于解决您的问题,请查看一下
GTM

This may help in solving your issue, have a look in to it
GTM

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文