delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/10/25/05:23:50

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
References: <Prayer DOT 1 DOT 0 DOT 18 DOT 0710251014170 DOT 2520 AT webmail0 DOT york DOT ac DOT uk>
Subject: RE: iostream with gcc
Date: Thu, 25 Oct 2007 10:23:30 +0100
Message-ID: <006d01c816e8$b4ee9ee0$2e08a8c0@CAM.ARTIMI.COM>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <Prayer.1.0.18.0710251014170.2520@webmail0.york.ac.uk>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

On 25 October 2007 10:14, Peter M Lee wrote:

> I apologize for what is probably a silly mistake on my part. I am just
> starting to use cygwin. When I tried a simple program
> 
> #include <iostream>
> using namespace std;
> 
> /**
>  * A simple program for demonstrating the basics of a C++ project.
>  */
> 
> int main() {
>     cout << "Hello, world";
>     cout << endl;
> 
>   return 0;
> }
> 
> with
> 
> $ gcc hello.cc
> 
> I got the following error message
> 
>
/cygdrive/c/Users/PB2579~1/AppData/Local/Temp/cc7nz7Xj.o:hello.cc:(.text+0xd):
> undefined reference to `std::basic_string<char, std::char_traits<char>,
> std::allocator<char> >::size() const'


  Use 'g++' to compile c++ programs, not 'gcc'.  Although they both are ver
similar drivers that invoke the sub-parts of the toolchain (compiler,
assembler, linkers), and in fact either one can recognize the extension of a
file and pass it to the right language version of the compiler, the g++ driver
also knows to add the appropriate -L and -l options for linking against the
standard C++ libraries automatically.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019