I am working on a program and am getting some strange compiler errors when I attempt to compile with Cygwin. The program compiles and runs just fine with Visual Studio C++ Express, so it seems to have something to do with Cygwin. All of the errors seem to be the same type. Here is an example of code:
int count_records(void)
{
EMPL_TYPE empl_rec;
fstream empl_infile;
empl_infile.open(filepath, ios::in|ios::binary);
int count = 0;
empl_infile.read((char *) &empl_rec, sizeof(empl_rec));
while (!empl_infile.eof())
{
count++;
empl_infile.read((char *) &empl_rec, sizeof(empl_rec));
}
empl_infile.close();
cout << "Records Counted: " << count << endl;
return count;
}
And here is the error related to that section:
Assignment2.cpp: In function int count_records()':
Assignment2.cpp:34: error: no matching function for call to
std::basic_fstream >::open(const std::string&, std::_Ios_Openmode)'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/fstream:819: note: candidates are: void std::basic_fstream<_CharT, _Traits>::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits]
Again, I do not get this error when compiling with Visual Studio, only with Cygwin. If anyone has any ideas, it would be appreciated. Thank you.