delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/09/21/14:35:47

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Lewis Hyatt <lhyatt AT princeton DOT edu>
Subject: Re: gcc does not know about "new" and "delete"
Date: Fri, 21 Sep 2007 14:35:05 -0400
Lines: 16
Message-ID: <fd12s9$kfu$1@sea.gmane.org>
References: <46F40C47 DOT 3040005 AT research DOT telcordia DOT com>
Mime-Version: 1.0
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
In-Reply-To: <46F40C47.3040005@research.telcordia.com>
X-IsSubscribed: yes
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

> This is what happens when I try to compile this program under cygwin on 
> my Windows XP machine:
> 
> % gcc newtest.cpp
> /tmp/ccReoXoA.o:newtest.cpp:(.text+0x32): undefined reference to 
> `operator new(unsigned int)'
> /tmp/ccReoXoA.o:newtest.cpp:(.text+0x5e): undefined reference to 
> `operator delete(void*)'
> collect2: ld returned 1 exit status
> 

gcc is compiling the C++ source fine, but it does not automatically 
figure out that it needs to link in the c++ runtime. You have to call it 
as "g++" instead. It works that way on Linux too.

-Lewis


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