Mail Archives: cygwin/2002/08/12/13:31:06
Hallo Ney,
Am Montag, 12. August 2002 um 19:12 schriebst du:
> 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,
Partially:
==========
$ g++ -o fstream fstream.cpp
In file included from /usr/include/g++-3/streambuf.h:36,
from /usr/include/g++-3/iostream.h:31,
from /usr/include/g++-3/fstream.h:30,
from /usr/include/g++-3/fstream:6,
from fstream.cpp:16:
/usr/include/g++-3/libio.h:30:23: _G_config.h: No such file or directory
In file included from /usr/include/g++-3/streambuf.h:36,
from /usr/include/g++-3/iostream.h:31,
from /usr/include/g++-3/fstream.h:30,
from /usr/include/g++-3/fstream:6,
from fstream.cpp:16:
/usr/include/g++-3/libio.h:239: '_G_off_t' is used as a type, but is not
defined as a type.
/usr/include/g++-3/libio.h:279: `read' was not declared in this scope
[...]
Still /usr/include/g++-3/fstream included instead of
/usr/include/c++/3.1.1/fstream and still getting the same errors,
and why does it work with g++-2 when compiling my original code?
However, your version works if gcc-2 is uninstalled, but shouldn't
it work with gcc-3 too, even if gcc-2 is also installed?
Gerrit
--
=^..^=
--
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/
- Raw text -