This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC3 problems with C++ fstream


Gerrit P. Haase wrote:

#include <fstream>
void main() //the program starts here
main() must return 'int'

{
ofstream SaveFile("cygwin.txt");
ofstream lives in the 'std' namespace

SaveFile << "Hello World, this works with gcc-2 but not with gcc-3!";
SaveFile.close();
}
Try this corrected version:

#include <fstream>

int main()
{
 using namespace std;

 ofstream saveFile("test.txt");
 saveFile << "Hello World, this works with gcc-2 but not with gcc-3!";
 saveFile.close();

 return 0;
}

Hope this helps,

--
Ney André de Mello Zunino
Media and Technology Laboratory
Campus Computing Centre
United Nations University


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]