title: C++ Separate Function File
body: <p>i'm trying to write my c++ program in different files, but I can't seem to get it to work. can someone help me?</p>
  
  <p>separate.cpp</p>
  
  <pre><code>#include "separate.h"
  #include &lt;iostream&gt;
  
  void Separate() {
  
  cout &lt;&lt; "text";
  
  }
  </code></pre>
  
  <p>separate.h</p>
  
  <pre><code>#include &lt;string&gt;
  using namespace std;
  
  class OneLine {
  
      Separate();
  
  private:
      string vari;
  
  };
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>#include "separate.cpp"
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main () {
  
      Separate s;
      s();
  
  return 0;
  }
  </code></pre>