delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/14/23:18:36

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: Michael Beach <michaelb AT ieee DOT org>
To: Motivus <motivus AT yahoo DOT com>, cygwin AT cygwin DOT com
Subject: Re: Cygwin/GCC can't link my code... either.
Date: Mon, 15 Jul 2002 13:22:43 +1000
References: <20020715030536 DOT 5752 DOT qmail AT web40208 DOT mail DOT yahoo DOT com>
In-Reply-To: <20020715030536.5752.qmail@web40208.mail.yahoo.com>
MIME-Version: 1.0
Message-Id: <02071513224328.01098@gilgamesh>

On Monday 15 July 2002 13:05, Motivus wrote:
> But it's only "Hello World!"...
>
> In my case, I'm running W2k & the latest Cygwin. I've searched the list
> (where I expected to find my answer right away), the FAQ, the docs... but
> turned up nothing.
>
> The code:
>
> #include <iostream>
>
> int main()
> {
>   std::cout << "Hello world!\n";
>   return 0;
> }
>
> The message:
>
> $ gcc hello.cpp
> /cygdrive/c/DOCUME~1/MOTIVU~1/LOCALS~1/Temp/ccCvXb2l.o(.text+0x24):hello.cp
>p: un
> defined reference to `cout'
> /cygdrive/c/DOCUME~1/MOTIVU~1/LOCALS~1/Temp/ccCvXb2l.o(.text+0x29):hello.cp
>p: un
> defined reference to `ostream::operator<<(char const *)'
> collect2: ld returned 1 exit status
>
> Please help.

Well, I'm reasonably certain that since you're doing a compile + link with 
"gcc" instead of "g++" you'll only be getting the standard C libraries rather 
than the C++ ones. Try using "g++" rather than "gcc", or else explicitly link 
with the standard C++ library using "-lstdc++".

>
> motivus

Regards
M.Beach

>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Autos - Get free new car price quotes
> http://autos.yahoo.com
>
> --
> 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