title: Infile incomplete type error
body: <p>I am building a program that takes an input file in this format:</p>
  
  <pre><code>title author
  
  title author
  
  etc
  
  and outputs to screen 
  
  title (author)
  
  title (author)
  
  etc
  </code></pre>
  
  <p>The Problem I am currently getting is a error:</p>
  
  <blockquote>
    <p>"ifstream infile has incomplete type and cannot be defined"</p>
  </blockquote>
  
  <p>Following is the program:</p>
  
  <pre><code>#include &lt;iostream&gt;              
  #include &lt;string&gt;
  #include &lt;ifstream&gt;
  using namespace std; 
  
  string bookTitle [14];
  string bookAuthor [14];
  int loadData (string pathname);         
  void showall (int counter);
  
  int main ()
  
  {
  int counter;  
  string pathname;
  
  cout&lt;&lt;"Input the name of the file to be accessed: ";
  cin&gt;&gt;pathname;
  loadData (pathname);
  showall (counter);
  }
  
  
  int loadData (string pathname) // Loads data from infile into arrays
  {
      ifstream infile; 
      int counter = 0;
      infile.open(pathname); //Opens file from user input in main
      if( infile.fail() )
       {
           cout &lt;&lt; "File failed to open";
           return 0;
       }   
  
       while (!infile.eof())
       {
             infile &gt;&gt; bookTitle [14];  //takes input and puts into parallel arrays
             infile &gt;&gt; bookAuthor [14];
             counter++;
       }
  
       infile.close;
  }
  
  void showall (int counter)        // shows input in title(author) format
  {
       cout&lt;&lt;bookTitle&lt;&lt;"("&lt;&lt;bookAuthor&lt;&lt;")";
  }
  </code></pre>