title: inclusion compilation model in c++
body: <pre><code>/*--------------------utilities.h-------------------------------------*/
  
  #ifndef UTILITIES_H
  #define UTILITIES_H
  
  template&lt;class T&gt; int compare(const T&amp;,const T&amp;);
  
  #include&lt;utilities.cpp&gt;
  #endif
  
  /*--------------------utilities.cpp-------------------------------------*/
  
  template&lt;class T&gt; int compare(const T &amp;v1 , const T &amp;v2)
  {
      if (v1 &lt; v2) return -1;
      if (v2 &lt; v1) return 1;
      return 0;
  }
  
  /*--------------------main.cpp------------------------------------------*/
  
  #include&lt;iostream&gt;
  #include&lt;utilities.h&gt;
  using namespace std;
  
  int main(int argc , char *argv[])
  {
      cout &lt;&lt; compare(1,2) &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>The code above is an example from a book. However, it gives errors when I compile the three files:</p>
  
  <pre><code>utilities.h:6:24: fatal error: utilities.cpp: No such file or directory
  compilation terminated.
  main.cpp:2:22: fatal error: utilities.h: No such file or directory
  compilation terminated.
  </code></pre>
  
  <p>I don't know why I get "No such file or directory"!</p>