加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ios – 使用Xcode 4.2编码覆盖 – 缺少文件

发布时间:2020-12-15 01:39:40 所属栏目:百科 来源:网络整理
导读:我跟着 Claus’s post在Xcode 4.2上使用LLVM 3.0设置代码覆盖.我可以看到测试覆盖率文件,但它们只适用于我的单元测试类,而不是我的实际项目类.我已经尝试在我的主要目标上将生成测试覆盖率文件和乐器程序流设置为是,但这没有帮助,因为它失败了以下错误: fop
我跟着 Claus’s post在Xcode 4.2上使用LLVM 3.0设置代码覆盖.我可以看到测试覆盖率文件,但它们只适用于我的单元测试类,而不是我的实际项目类.我已经尝试在我的主要目标上将生成测试覆盖率文件和乐器程序流设置为是,但这没有帮助,因为它失败了以下错误:

fopen $UNIX2003从函数llvm_gcda_start_file调用

为了澄清,我不认为这是正确的方法 – 我只是试图看看它是否会在我的项目类上生成代码覆盖.

在这一点上,我很乐意尝试任何代码覆盖在我的应用程序上工作的东西.有什么建议么?

解决方法

您期望的链接器问题,profile_rt库使用fopen $UNIX2003和fwrite $UNIX2003函数,而不是fopen和fwrite.

您需要的是将以下.c文件添加到您的项目中:

#include <stdio.h>

FILE *fopen$UNIX2003( const char *filename,const char *mode )
{
    return fopen(filename,mode);
}

size_t fwrite$UNIX2003( const void *a,size_t b,size_t c,FILE *d )
{
    return fwrite(a,b,c,d);
}

这个代码只是将缺少的函数重新映射到标准的函数.

注意$UNIX2003后缀:

我发现一个Apple document说:

The UNIX? conformance variants use the $UNIX2003 suffix.

Important: The work for UNIX? conformance started in Mac OS 10.4,but was not completed until 10.5. Thus,in the 10.4 versions of libSystem.dylib,many of the conforming variant symbols (with the $UNIX2003 suffix) exist. The list is not complete,and the conforming behavior of the variant symbols may not be complete,so they should be avoided.

Because the 64-bit environment has no legacy to maintain,it was created to be UNIX? conforming from the start,without the use of the $UNIX2003 suffix. So,for example,_fputs$UNIX2003 in 32-bit and _fputs in 64-bit will have the same conforming behavior.

所以我希望libprofile_rt链接到10.4 SDK.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读