title: how to split code into main.cpp header file
body: <p>The problem is I have a console platformer game(everything is written in one .cpp file). I have a buffer structure and my goal is to move definition of the structure to engine.h and definition of buffer's functions to engine.cpp.</p>
  <p>engine.h file:</p>
  <pre><code>struct buffer
  {
  private:
      char** arr;
      char** dum;
      int width;
      int height;
      vector&lt;platform&gt; vc;
      vector&lt;enemy*&gt; ve;
  public:
      buffer(const int, const int);
      void fill(character, vector&lt;enemy*&gt;);
      void render(const int, const int);
      char** getArray();
      void addPlatforms();
      void addE(enemy*);
      vector&lt;platform&gt; getPlatforms();
      vector&lt;enemy*&gt; getEnemies();
      ~buffer();
  };
  </code></pre>
  <p>engine.cpp file:</p>
  <pre><code>#include &quot;engine.h&quot;
  #include &lt;fstream&gt;
  #include &lt;vector&gt;
  
  void buffer::fill(chracter charact, vector&lt;enemy*&gt; ve)
  {
      for (int i = 0; i &lt; this-&gt;height; ++i)
      {
          for (int j = 0; j &lt; this-&gt;width; ++j)
          {
              this-&gt;arr[i][j] = this-&gt;dum[i][j];
          }
      }
      this-&gt;arr[charact.getY()][charact.getX()] = '@';
      for (enemy* e : ve)
      {
          if (e-&gt;isAlive())
              this-&gt;arr[e-&gt;getY()][e-&gt;getX()] = 'M';
      }
      this-&gt;arr[0][max(charact.getX() - 10, 0)] = '0' + charact.getCoins() / 2;
  }
  </code></pre>
  <p>Like here fill() take character object and structure character is defined in main.cpp.</p>
  <pre><code>struct character
  {
  private:
      int x;
      int y;
      int vx;
      int vy;
      bool onGround = false;
      bool up = false;
      bool left = false;
      bool right = false;
      bool jump = false;
      int coins = 0;
      int i = 0;
  public:
      character(const int, const int);
      int getX();
      int getY();
      int getVy();
      int getCoins();
      void setRight(bool);
      void setLeft(bool);
      void setUp(bool);
      void setOnground(bool);
      int update(vector&lt;platform&gt;, vector&lt;enemy*&gt;);
      void collide(int vx, int vy, vector&lt;platform&gt;);
      bool collideO(platform);
  };
  
  int main()
  {
      buffer screen{ 209, 15 };
      character charact{0, 12 };
  
      enemy en1{ 35, 12 };
      enemy en2{ 73, 12 };
      enemy en3{ 78, 8};
      enemy en4{ 51, 12 };
  
      screen.addE(&amp;en1);
      screen.addE(&amp;en2);
      screen.addE(&amp;en3);
      screen.addE(&amp;en4);
  
      screen.fill(charact, screen.getEnemies());
  </code></pre>
  <p>The problem is engine.cpp cannot see character structure defined in Main.cpp, so how can I resolve this? I was thinking about lambdas but I'm pretty noobie.
  If you need some more explanation or more code ask me :)</p>