X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: <46F4741F.80108@pacific.net.sg> Date: Sat, 22 Sep 2007 09:47:11 +0800 From: Erich Dollansky User-Agent: Thunderbird 2.0.0.6 (X11/20070826) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: gcc does not know about "new" and "delete" References: <46F40C47 DOT 3040005 AT research DOT telcordia DOT com> In-Reply-To: <46F40C47.3040005@research.telcordia.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hi, Framk gave you the answer. gcc is a plain c compiler. Erich Joel W. Gannett wrote: > I've checked but was unable to find any FAQs on this subject, as > keywords such as "new" and "delete" apparently created too many hits. > > Why doesn't my cygwin gcc know about the standard C++ functions "new" > and "delete"? Here is an ultra-simple program (newtest.cpp) that won't > compile for me under cygwin: > > // program begin > > #include > > int > main() > { > int *i; > i = new int; > *i = 15; > printf ( "hello, world: %d\n", *i ); > delete i; > return 0; > } > > // program end > > 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 > > Also, I get essentially the same compilation failure messages when I try > to compile this under cygwin on my Windows 2000 machine. > > When I compile this simple program using gcc on a Sun Unix workstation, > it compiles fine, with no messages, and runs fine as well. > > Any help on this problem would be appreciated. I have attached the > cygcheck.out file for my Windows XP machine. > > > ------------------------------------------------------------------------ > > -- > 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/ -- 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/