# \`Codecov\` output is different from \`lcov\`

**URL:** <https://community.codecov.com/t/codecov-output-is-different-from-lcov/1348>\
**Category:** Bug Fixes\
**Created:** [April 28, 2020, 7:09pm UTC](https://community.codecov.com/t/codecov-output-is-different-from-lcov/1348 "2020-04-28T19:09:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cvelth](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@Cvelth](https://community.codecov.com/u/Cvelth)\
**Post date:** [April 28, 2020, 7:09pm UTC](https://community.codecov.com/t/codecov-output-is-different-from-lcov/1348/1 "2020-04-28T19:09:11Z")

</div>

### Description

The output of codecov: [link](https://codecov.io/gh/Cvelth/argument_parser/src/267c8efcc1901839a0c59f108a8afa049b845c87/include/argument_parser.hpp) is different from the Lcov output for the same file (`gcov 9.3.0` is used on both): [link](https://drive.google.com/open?id=1D1a6h21vMtfMMK3ey3wQ16YXGzREw-RK).  
The file itself: [link](https://github.com/Cvelth/argument_parser/blob/github_actions_workflow_redesign/include/argument_parser.hpp).  
The `gcov` file: [link](https://drive.google.com/open?id=1_4mu1o0trXFP4m_FG9uHaquVgIb9QjsU)

### Repository

Only 4 links per post, so:  
github.com-\>Cvelth-\>argument\_parser

### Steps to Reproduce

1. run `codecov`
2. run `lcov`
3. compare them

**Expected behavior:** Similar results

**Actual behavior:** `10%` coverage vs `55%`

**Flakiness?** All the time.

### Versions

Windows 10 + WSL Ubuntu 18.04  
GCC 9.3.0 (with GCOV)  
LCOV 1.14-6-g40580cd

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [May 8, 2020, 6:37pm UTC](https://community.codecov.com/t/codecov-output-is-different-from-lcov/1348/2 "2020-05-08T18:37:37Z")

</div>

Hmmm, this is strange. Unfortunately, it seems like the coverage report we receive is different from the one generated in your second link. As an example, we receive this from CircleCI [https://codecov.io/gh/Cvelth/argument\_parser/commit/267c8efcc1901839a0c59f108a8afa049b845c87/build](https://codecov.io/gh/Cvelth/argument_parser/commit/267c8efcc1901839a0c59f108a8afa049b845c87/build)

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/1X/ccd4743be85656497e052901906a029d9d6875e1.png)

Raw report: [https://codecov.io/codecov/v4/raw/2020-04-28/0DCFB4EA8A9DDE8A022AAA2556F2C713/267c8efcc1901839a0c59f108a8afa049b845c87/3832b657-b09b-466a-bd0e-ce27bf728010.txt](https://codecov.io/codecov/v4/raw/2020-04-28/0DCFB4EA8A9DDE8A022AAA2556F2C713/267c8efcc1901839a0c59f108a8afa049b845c87/3832b657-b09b-466a-bd0e-ce27bf728010.txt)

You’ll see that it starts at line 48, but the file you linked shows up at 38 first

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/1X/d6dc9cd5c06986c78d7f8c13ed67910fb59ac896.png)

Somewhere when you are calling `codecov` we are receiving a different file.

---

<div class="post-metadata">

**Author:** ![Cvelth](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@Cvelth](https://community.codecov.com/u/Cvelth)\
**Post date:** [May 8, 2020, 9:02pm UTC](https://community.codecov.com/t/codecov-output-is-different-from-lcov/1348/3 "2020-05-08T21:02:18Z")

</div>

Thanks for the answer, but I’ve already solved the issue with a different method: it seems like inconsistency was caused by the analyzed file being a header. Writing a simple script to combine all the sources into a single `cpp` and measuring code coverage on it resolved any problems.

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [May 8, 2020, 9:26pm UTC](https://community.codecov.com/t/codecov-output-is-different-from-lcov/1348/4 "2020-05-08T21:26:34Z")

</div>

Amazing! Glad that it worked out for you.
