delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/08/12/13:02:22

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Mon, 12 Aug 2002 18:48:02 +0200
From: "Gerrit P. Haase" <gp AT familiehaase DOT de>
Reply-To: "Gerrit P. Haase" <gp AT familiehaase DOT de>
Organization: Esse keine toten Tiere
X-Priority: 3 (Normal)
Message-ID: <187198960129.20020812184802@familiehaase.de>
To: cygwin AT cygwin DOT com
Subject: GCC3 problems with C++ fstream
MIME-Version: 1.0

Hallo,

Code:
=====
#include <fstream>
void main() //the program starts here
{
ofstream SaveFile("cygwin.txt");
SaveFile << "Hello World, this works with gcc-2 but not with gcc-3!";
SaveFile.close();
}

GCC3:
=====
$ g++ --version
g++ (GCC) 3.1.1 20020718 (prerelease)

$ 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:1:
/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:1:
/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

[...and on...]


I wonder: why is not included:
/usr/include/c++/3.1.1/fstream
but /usr/include/g++-3/fstream?




GCC2:
=====
$ g++-2 --version
2.95.3-9

$ g++-2 -o fstream fstream.cpp

$ cat cygwin.txt
cat: cygwin.txt: No such file or directory

$ ./fstream

$ cat cygwin.txt
Hello World, this works with gcc-2 but not with gcc-3!


Is just _G_config.h missing in the Cygwin dist of GCC3?
If I remove GCC2 I get a different behaviour:

$ g++ -o fstream fstream.cpp
fstream.cpp:4: `main' must return `int'
fstream.cpp: In function `int main(...)':
fstream.cpp:6: `ofstream' undeclared (first use this function)
fstream.cpp:6: (Each undeclared identifier is reported only once for each 
   function it appears in.)
fstream.cpp:6: parse error before `(' token
fstream.cpp:8: `SaveFile' undeclared (first use this function)


Hmmm...

Gerrit
-- 
"All faults& bugs are mine - Robert"
    from squid/acinclude.m4,   Sun Apr 21 05:21:21 2002


--
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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019