Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Message-ID: <3D57EC78.9060206@unu.edu>
Date: Tue, 13 Aug 2002 02:12:24 +0900
From: =?ISO-8859-1?Q?Ney_Andr=E9_de_Mello_Zunino?= <zunino@unu.edu>
Organization: UNU Campus Computing Centre
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1b) Gecko/20020801
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: GCC3 problems with C++ fstream
References: <187198960129.20020812184802@familiehaase.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
X-Virus-Check: by UNU Campus Computing Centre (HQmail)

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/

