std::ofstream

Dean Hoover dhoover@rochester.rr.com
Wed Jul 18 11:21:00 GMT 2001


I am using gcc-3.0 and the following fails to
compile, which I believe should be OK. I
lifted the line in question from page 632 of
Josuttis.

#include <iostream>

int main()
{
        std::ofstream file("xyz.out", std::ios::out|std::ios::app);
}

The errors from the compiler were:

g++     foobar.cc   -o foobar
foobar.cc: In function `int main()':
foobar.cc:5: variable `std::ofstream file' has initializer but
incomplete type
make: *** [foobar] Error 1

Am I in error somewhere?

Thanks.

Dean Hoover



More information about the Libstdc++ mailing list