Using fstream in a class
<p>I have have to use a fstream in my controller class. My controller class is an interface of my driver class but I'm having a little problem setting it up. My header code is...</p>

<pre><code>#pragma once
#include &lt;fstream&gt;
#include &lt;string&gt;

using namespace std;

class Controller
{
public:
  void loadFromFile ();

private:
  int index;
  fstream file;
};
</code></pre>

<p>and my .cpp code is...</p>

<pre><code>#include "Controller.h"
#include &lt;fstream&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;

using namespace std;

void Controller::loadFromFile ()
{
  file.open("Programming Assignment 4 Data.txt");
}
</code></pre>

<p>There is a red squiggly line under my "file" in my header and the error says
"Error: incomplete type is not allowed"</p>

<p>What should I do?</p>

<p>Thank y'all</p>
