gcc does not know about "new" and "delete"
Erich Dollansky
oceanare@pacific.net.sg
Sat Sep 22 01:47:00 GMT 2007
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 <stdio.h>
>
> 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/
More information about the Cygwin
mailing list