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 Message-ID: <3EFDC620.8060402@t-online.de> Date: Sat, 28 Jun 2003 18:45:20 +0200 From: =?ISO-8859-1?Q?Markus_Sch=F6nhaber?= Reply-To: cygwin AT cygwin DOT com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: de-de, de, en-us, en MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: g++ error References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Peng Yu wrote: > Hi, > When I tried to compile this file by g++, I got a error. > > #include > int main(){ > cout << "Hello World" << endl; > } > > errors are: > > test.C: In function `int main()': > test.C:3: `cout' undeclared (first use this function) > test.C:3: (Each undeclared identifier is reported only once for each > function > it appears in.) > test.C:3: `endl' undeclared (first use this function) > > Do I need to install some library? No, you simply have to respect C++ namespaces. Try std::cout << ... << std:endl; or alternatively #include using namespace std; ... Regards mks -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/