title: Use variables defined in a different source file
body: <p>i want to get a value from another cpp file </p>
  
  <p>for example this one is in fileone.cpp :</p>
  
  <pre><code>for (int i = 0; i &lt; NSIZE(facerects); i++)
      {
  
          DetPar detpar;
  
          detpar.x = facerect-&gt;x + facerect-&gt;width / 2.;
          *gX=facerect-&gt;x;
          detpar.y = facerect-&gt;y + facerect-&gt;height / 2.;
          *gY=facerect-&gt;y;
  
      }
  </code></pre>
  
  <p>and i want to get the value of *gX , *gY in file2.cpp</p>
  
  <p>in java we can do that with getters= but what is the easy way to do it in c++?</p>