X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Lewis Hyatt <lhyatt@princeton.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.3040005@research.telcordia.com>
Mime-Version:  1.0
Content-Type:  text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding:  7bit
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@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.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/

