gcc does not know about "new" and "delete"
Lewis Hyatt
lhyatt@princeton.edu
Fri Sep 21 18:35:00 GMT 2007
> 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/
More information about the Cygwin
mailing list