【问题标题】:Renaming gcov files for various compilation为各种编译重命名 gcov 文件
【发布时间】:2013-05-29 10:19:38
【问题描述】:

如何在每次编译时为 .gcda 和 .gcno 文件指定特定名称而不是默认名称,以便我可以在 lcov 中组合所有结果。

假设在下面的代码中。

enter code here
#include<stdio.h>
main()
{
    int n;
    printf("Enter an integer\n");
    scanf("%d",&n);

    if ( n%2 == 0 )
       printf("Even\n");
    else
       printf("Odd\n");

    return 0;
}

第一次编译时我想生成 test1.gcno 和 test1.gcda 文件,如果 c 文件的名称保存为 check.c,我想再次生成 test2.gcno 和 test.2gcda 文件

【问题讨论】:

    标签: c linux gcc gcov


    【解决方案1】:

    如果您使用的是 Windows,则可以使用 CopyFile(source, destination, FALSE); 检查您编译的次数,只需分析CopyFile() 使用fopen("test.txt", "r"); 之类的打开文件函数复制了多少文件。如果文件不存在,则返回 NULL。

    【讨论】:

      猜你喜欢
      • 2013-05-17
      • 2014-01-13
      • 1970-01-01
      • 2010-11-28
      • 1970-01-01
      • 1970-01-01
      • 2012-11-25
      • 2012-12-15
      • 2014-09-18
      相关资源
      最近更新 更多