
-----------------------------------
BigBear
Thu Apr 22, 2010 2:07 pm

MinGW Problem
-----------------------------------
I have been compiling code fine at school and I just installed the newest version of MinGW and it won't compile.

I was wondering if some major changes have been done in version 5.1.6.

Not sure what version I was using at school.

I am having a problem with 

[code]
#include 
#include 
#include 

using namespace std;

ifstream myFile;
myFile.open (_fileName);
[/code]

[code]
myFile.open (_fileName);
error: no matching function for call to `std::basic_ifstream::open(std::string&)'
[/code]

-----------------------------------
TerranceN
Thu Apr 22, 2010 3:05 pm

RE:MinGW Problem
-----------------------------------
I can see in the error that _fileName is a string, and ifstream.open() does not accept strings. You need to convert it to a c-string (which is just an array of chars) using string's c_str() method (so use _fileName.c_str() instead of just _fileName). Hope that helps.

-----------------------------------
Euphoracle
Thu Apr 22, 2010 4:15 pm

RE:MinGW Problem
-----------------------------------
Didn't I already tell you this on irc...

-----------------------------------
BigBear
Thu Apr 22, 2010 4:23 pm

RE:MinGW Problem
-----------------------------------
Alright thanks that fixed it. I wonder why it worked at school...
