I'm learning gcov to generate a coverage report. These codes are follows: a.h
#include <stdio.h>
int A(int a);
a.c
#include "a.h"
int A(int a)
{
int b = a * a * a * a;
return b;
}
main.c
#include <stdio.h>
#include "a.h"
int main()
{
int a1 = A(33);
printf("a1 = %d\n", a1);
return 1;
}
And I compile codes using gcc *.c *.h -o main -fprofile-arcs -ftest-coverage,
then files in current dir are a.c a.gcno a.h main main.c main.gcno.
Next,
root@DESKTOP-D0VRGT9:/home/liguoyang/coverage# lcov -d . --capture -o main.info
Capturing coverage data from .
Found gcov version: 9.3.0
Using intermediate gcov format
Scanning . for .gcda files ...
Found 2 data files in .
Processing a.gcda
/home/liguoyang/coverage/a.gcno:not a gcov notes file
/home/liguoyang/coverage/a.gcda:stamp mismatch with notes file
geninfo: WARNING: GCOV did not produce any data for /home/liguoyang/coverage/a.gcda
Processing main.gcda
Finished .info-file creation
here I get a error
/home/liguoyang/coverage/a.gcno:not a gcov notes file
/home/liguoyang/coverage/a.gcda:stamp mismatch with notes file
and
root@DESKTOP-D0VRGT9:/home/liguoyang/coverage# genhtml -o result main.info
Reading data file main.info
Found 1 entries.
Found common filename prefix "/home/liguoyang"
Writing .css and .png files.
Generating output.
Processing file coverage/main.c
Writing directory view page.
Overall coverage rate:
lines......: 100.0% (4 of 4 lines)
functions..: 100.0% (1 of 1 function)
When generating a html, there is nothing about a.c.