delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/11/28/03:47:57

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
X-Originating-IP: [198.142.199.187]
From: "Gareth Pearce" <tilps AT hotmail DOT com>
To: <cygwin AT cygwin DOT com>, "Craig Sproule" <craigsproule AT yahoo DOT com DOT au>
References: <20011128062415 DOT 66208 DOT qmail AT web20104 DOT mail DOT yahoo DOT com> <117301454478 DOT 20011128092612 AT familiehaase DOT de>
Subject: Re: Trouble compiling a C++ Program
Date: Wed, 28 Nov 2001 19:47:20 +1100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <OE73CPZxinTf1wGPnq7000179e7@hotmail.com>
X-OriginalArrivalTime: 28 Nov 2001 08:47:19.0920 (UTC) FILETIME=[4A35A700:01C177E9]


> Hallo Craig,
>
> Am 2001-11-28 um 07:24 schriebst du:
>
> > I have downloaded the latest version of CygWin. When I
> > compile the following C++ program:
>
> > // Filename: Welcome.cpp
> > // A first program in C++
> > #include <iostream.h>
>
> > int main()
> > {
> > cout << "Welcome to C++!\n";
>
> > return 0;
> > }
>
> > gcc pops out the following error:
>
> > welcome.cpp: undefined reference to `cout'
>
> > So my question is, how do I get Cygwin to compile this
> > program?
>
> $ g++ -o hello2 hello2.cc
>
> $ hello2
> Welcome to C++!
>
> I remember that if you use the extension .cc, gcc calls g++
> automagically, but it doesn't work.

which is i believe because g++ invoked directly has an implied -lstdc++
if you do gcc -lstdc++ it will also compile just fine.  Ofcourse g++ is
probably a better move for some reason... (other then reduced typing)
>
> Ciao,
>
> Gerrit P. Haase                            mailto:gp AT familiehaase DOT de
> --
> =^..^=
>
>
> --
> 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/
>
>

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