Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 19:31:05 +0200 From: "Gerrit P. Haase" Organization: Esse keine toten Tiere X-Priority: 3 (Normal) Message-ID: <117201543804.20020812193105@familiehaase.de> To: cygwin AT cygwin DOT com Subject: Re: GCC3 problems with C++ fstream In-Reply-To: <3D57EC78.9060206@unu.edu> References: <187198960129 DOT 20020812184802 AT familiehaase DOT de> <3D57EC78 DOT 9060206 AT unu DOT edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hallo Ney, Am Montag, 12. August 2002 um 19:12 schriebst du: > Gerrit P. Haase wrote: >> #include >> 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 > 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/