title: C++: variable 'std::ifstream ifs' has initializer but incomplete type
body: <p>Sorry if this is pretty noobish, but I'm pretty new to C++. I'm trying to open a file and read it using <code>ifstream</code>:</p>
  
  <pre><code>vector&lt;string&gt; load_f(string file) {
    vector&lt;string&gt; text;
  
    ifstream ifs(file);
    string buffer, str_line;
  
    int brackets = 0;
    str_line = "";
  
    while ( getline(ifs, buffer) ) {
      buffer = Trim( buffer );
      size_t s = buffer.find_first_of("()");
  
      if (s == string::npos) str_line += "" + buffer;
      else {
        while ( s != string::npos ) {
          str_line += "" + buffer.substr(0, s + 1);
          brackets += (buffer[s] == '(' ? 1 : -1);
  
          if ( brackets == 0 ) {
            text.push_back( str_line );
            str_line = "";
          }
  
          buffer = buffer.substr(s + 1);
          s = buffer.find_first_of("()");
        }
      }
    }
  
    return text;
  }
  </code></pre>
  
  <p>However, I'm getting the following error I'm not quite sure how to fix:</p>
  
  <pre><code>variable 'std::ifstream ifs' has initializer but incomplete type
  </code></pre>
  
  <p>Answers very appreciated. Note that I never forgot to <code>#include &lt;fstream&gt;</code>, since many have gotten the error due to just forgetting to include the header.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Turns out that I actually did forget to include <code>fstream</code>, but I had forgotten due to moving the function to another file.</p>