title: How to use header files?
body: <p>I wanted to learn using header files. and I got an error. here is my code:</p>
  
  <p><strong>printmyname.h:</strong></p>
  
  <pre><code>void printMyName();
  </code></pre>
  
  <p><strong>printmyname.cpp:</strong></p>
  
  <pre><code>#include "printmyname.h"
  
  void printMyName() {
      cout &lt;&lt; "omer";
  }
  </code></pre>
  
  <p><strong>try.cpp (main file):</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "printmyname.h"
  using namespace std;
  
  
  int main() {
      printMyName();
  
      return 0;
  }
  </code></pre>
  
  <p>Here is the error:</p>
  
  <pre><code>undefined reference to `printMyName()`
  </code></pre>
  
  <p>What's is the problem?</p>