title: Code coverage of Multiple files using Gcovr
body: <p>i am new to gcovr. I have 3 files in my code namely main.cpp, math.cpp and math.hpp.I am compiled it with g++ using the following command </p>
  
  <pre><code>g++ -fprofile-arcs -ftest-coverage -fPIC -O0 main.cpp  math.cpp math.hpp -o math
  </code></pre>
  
  <p>my code is compiled and run successfully. when i run the following command for code coverage </p>
  
  <pre><code> gcovr -r .
  </code></pre>
  
  <p>it produces the output like this </p>
  
  <pre><code>------------------------------------------------------------------------------
                         GCC Code Coverage Report
  Directory: .
  ------------------------------------------------------------------------------
  File                                       Lines    Exec  Cover   Missing
  ------------------------------------------------------------------------------
  main.cpp                                       6       6   100%
  ------------------------------------------------------------------------------
  TOTAL                                          6       6   100%
  ------------------------------------------------------------------------------ 
  </code></pre>
  
  <p>It shows only the code coverage of main.cpp. I want to know the code coverage of other files too.How can i get it? Please help me if you can.Thanks in advance.</p>
  
  <p>Here is my code 
  main.cpp </p>
  
  <pre><code>#include "math.hpp"
  int main( int argc, char **argv)
  {
      Math m;
      m.Multiply(20, 50);
      m.Divide(40, 5);
  }
  </code></pre>
  
  <p>Math.cpp</p>
  
  <pre><code>#include "math.hpp"
  
  using namespace std;
  int Math::Multiply(int Num1, int Num2){
      Mul= Num1 * Num2;
      std::cout &lt;&lt; "Multiplication of "&lt;&lt;Num1&lt;&lt; " * " &lt;&lt;Num2&lt;&lt; " = "&lt;&lt; Mul&lt;&lt;endl;
      return Mul;
  }
  
  int Math::Divide(int Num1, int Num2){
      Div = Num1/Num2;
      std::cout &lt;&lt; "Division of "&lt;&lt;Num1&lt;&lt; " / " &lt;&lt;Num2 &lt;&lt;" = "&lt;&lt; Div&lt;&lt;endl;
      return Div;
  }
  </code></pre>
  
  <p>math.hpp</p>
  
  <pre><code>#include &lt;ctime&gt;
  #include&lt;iostream&gt;
  class Math
  {
    int Num1;
    int Num2;
    int Fact, Mul, Div, Num, i;
  
  public:
    int Multiply(int Num1,int Num2);
    int Divide(int Num1, int Num2);
  };
  </code></pre>
  
  <p>When ran the command gcovr -v -r . is given below</p>
  
  <pre><code>C:\Users\user\Desktop\Gcovr&gt;gcovr -v -r .
  Filters for --root: (1)
  - &lt;_sre.SRE_Pattern object at 0x01C206A0&gt;
  Filters for --filter: (1)
  - DirectoryPrefixFilter(C\:\/Users\/user\/Desktop\/Gcovr\/)
  Filters for --exclude: (0)
  Filters for --gcov-filter: (1)
  - AlwaysMatchFilter()
  Filters for --gcov-exclude: (0)
  Filters for --exclude-directories: (0)
  Scanning directory . for gcda/gcno files...
  Found 4 files (and will process 2)
  Pool started with 1 threads
  Processing file: C:\Users\user\Desktop\Gcovr\main.gcda
  Running gcov: 'gcov C:\Users\user\Desktop\Gcovr\main.gcda --branch-counts -- 
  branch-probabilities --preserve-paths --object-directory 
  C:\Users\user\Desktop\Gcovr' in 'c:\users\user\appdata\local\temp\tmpyekiry'
  Running gcov: 'gcov C:\Users\user\Desktop\Gcovr\main.gcda --branch-counts -- 
  branch-probabilities --preserve-paths --object-directory 
  C:\Users\user\Desktop\Gcovr' in 'C:\Users\user\Desktop\Gcovr'
  Finding source file corresponding to a gcov data file
    currdir      C:\Users\user\Desktop\Gcovr
    gcov_fname   c:\users\user\appdata\local\temp\tmpyekiry\main.cpp.gcov
             [u'        -', u'    0', u'Source', u'main.cpp\n']
    source_fname C:\Users\user\Desktop\Gcovr\main.gcda
    root         C:\Users\user\Desktop\Gcovr
    fname        C:\Users\user\Desktop\Gcovr\main.cpp
  Parsing coverage data for file C:\Users\user\Desktop\Gcovr\main.cpp
  uncovered: set([])
  covered:   {2: 1, 5: 1, 6: 1, 7: 4}
  branches:  {5: {1: 1, 2: 0}, 6: {1: 1, 2: 0}, 7: {1: 1, 2: 0, 3: 1, 4: 0}}
  noncode:   set([3])
  Finding source file corresponding to a gcov data file
    currdir      C:\Users\user\Desktop\Gcovr
    gcov_fnamec:\users\user\appdata\local\temp\tmpyekiry\c~#mingw#lib#gcc#mingw32#6.3.0#include#c++#iostream.gcov
             [u'        -', u'    0', u'Source', 
  u'c:/mingw/lib/gcc/mingw32/6.3.0/include/c++/iostream\n']
    source_fname C:\Users\user\Desktop\Gcovr\main.gcda
    root         C:\Users\user\Desktop\Gcovr
    fname        c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream
  Parsing coverage data for file c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream
    Filtering coverage data for file c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream
  Processing file: C:\Users\user\Desktop\Gcovr\math.gcda
  Running gcov: 'gcov C:\Users\user\Desktop\Gcovr\math.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory C:\Users\user\Desktop\Gcovr' in 'c:\users\user\appdata\local\temp\tmpyekiry'
  Gathered coveraged data for 1 files
  </code></pre>