title: why this compiler error? - no matching function for call to 'std::basic_ofstream<char>::open(std::string&)'
body: <p>This works on Visual Studio and it works on GCC 4.9.2 on one computer.</p>
  
  <p>But on a different computer, I think it's the same GCC 4.9.2 compiler, but it gives me this error.</p>
  
  <p>Am I missing something? What's going on?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main()
  {
      string filename;
      filename = "teststring";
      ofstream fout;
      fout.open(filename);
      fout &lt;&lt; "Hello world!" &lt;&lt; endl;
      fout.close();
      return 0;
  }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>||=== Build: Debug in fileiotest (compiler: TDM32 GNU GCC Compiler 4.9.2 dw2) ===|
  F:\Users\XXX\cpp\fileiotest\main.cpp||In function 'int main()':|
  F:\Users\XXX\cpp\fileiotest\main.cpp|12|error: no matching function for call to 'std::basic_ofstream&lt;char&gt;::open(std::string&amp;)'|
  F:\Users\XXX\cpp\fileiotest\main.cpp|12|note: candidate is:|
  F:\TDM-GCC-32\lib\gcc\mingw32\4.9.2-dw2\include\c++\fstream|716|note: void std::basic_ofstream&lt;_CharT, _Traits&gt;::open(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits&lt;char&gt;; std::ios_base::openmode = std::_Ios_Openmode]|
  F:\TDM-GCC-32\lib\gcc\mingw32\4.9.2-dw2\include\c++\fstream|716|note:   no known conversion for argument 1 from 'std::string {aka std::basic_string&lt;char&gt;}' to 'const char*'|
  ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
  </code></pre>