public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Gareth Pearce" <tilps@hotmail.com>
To: <cygwin@cygwin.com>, "Craig Sproule" <craigsproule@yahoo.com.au>
Subject: Re: Trouble compiling a C++ Program
Date: Sun, 18 Nov 2001 10:21:00 -0000	[thread overview]
Message-ID: <OE73CPZxinTf1wGPnq7000179e7@hotmail.com> (raw)
In-Reply-To: <117301454478.20011128092612@familiehaase.de>



> 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@familiehaase.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/

WARNING: multiple messages have this Message-ID
From: "Gareth Pearce" <tilps@hotmail.com>
To: <cygwin@cygwin.com>, "Craig Sproule" <craigsproule@yahoo.com.au>
Subject: Re: Trouble compiling a C++ Program
Date: Wed, 28 Nov 2001 00:47:00 -0000	[thread overview]
Message-ID: <OE73CPZxinTf1wGPnq7000179e7@hotmail.com> (raw)
Message-ID: <20011128004700.EcKRsoW8-aT6EpMzPquqjlP3oGjHe5dlxtn3ZjzNRTw@z> (raw)
In-Reply-To: <117301454478.20011128092612@familiehaase.de>

> 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@familiehaase.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/

  reply	other threads:[~2001-11-28  8:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-18  4:26 Craig Sproule
2001-11-18  4:50 ` Matthew Smith
2001-11-27 22:32   ` Matthew Smith
2001-11-18 10:21 ` Gerrit P. Haase
2001-11-18 10:21   ` Gareth Pearce [this message]
2001-11-28  0:47     ` Gareth Pearce
2001-11-28  0:38   ` Gerrit P. Haase
2001-11-27 22:24 ` Craig Sproule
2001-11-18 19:42 Andrew Volkov
2001-11-28  6:36 ` Andrew Volkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OE73CPZxinTf1wGPnq7000179e7@hotmail.com \
    --to=tilps@hotmail.com \
    --cc=craigsproule@yahoo.com.au \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).