delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/12/22/10:49:09

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
From: Florin Jurcovici <flj AT mail DOT dnttm DOT ro>
To: cygwin AT cygwin DOT com
Date: Sun, 22 Dec 2002 17:44:20 +0200
X-Priority: 3 (Normal)
Organization: Private
In-Reply-To: <NCBBLKKJGBJOLDFMCKFPAECFCBAA.dockeen@mchsi.com>
Message-Id: <FEYTHC41VU6HC72VG51WSZYUP43VU.3e05ddd4@d3>
Subject: Re: What's wrong? gcc brain-damaged on cygwin?
MIME-Version: 1.0

Hello.

Got two answers, pointing to the same solution, here's the result when trying to apply it:

XXX AT yyy /tmp
$ g++ testnewchar.cc
/tmp/cc2MeN0q.o(.text+0x26):testnewchar.cc: undefined reference to `operator new
[](unsigned)'
/tmp/cc2MeN0q.o(.text+0x34):testnewchar.cc: undefined reference to `operator del
ete(void*)'
collect2: ld returned 1 exit status

XXX AT yyy /tmp
$ c++ testnewchar.cc
/tmp/ccvys8Rg.o(.text+0x26):testnewchar.cc: undefined reference to `operator new
[](unsigned)'
/tmp/ccvys8Rg.o(.text+0x34):testnewchar.cc: undefined reference to `operator del
ete(void*)'
collect2: ld returned 1 exit status

XXX AT yyy /tmp
$ c++ -lstdc++ testnewchar.cc
/tmp/ccFVl1ml.o(.text+0x26):testnewchar.cc: undefined reference to `operator new
[](unsigned)'
/tmp/ccFVl1ml.o(.text+0x34):testnewchar.cc: undefined reference to `operator del
ete(void*)'
collect2: ld returned 1 exit status

Any other ideas? Could it be that when compiling and installing gcc with --enable-languages=c++ only gcc doesn't install some 
essential libs?

Best regards,

Florin Jurcovici
flj AT mail DOT dnttm DOT ro
-----------------
Complex problems have simple, easy to understand wrong answers.


Initial request for help:

> I installed gcc 3.2 on my machine, only the C++ language pack, and it compiled, checked and installed without error. Now,  > 
> when I ask gcc about version info it says:
>
> $ gcc -v
> Reading specs from /usr/local/lib/gcc-lib/i686-pc-cygwin/3.2/specs
> Configured with: ../gcc-3.2/configure --enable-threads=win32 --enable-languages=
> c++
> Thread model: win32
> gcc version 3.2
>
>
> Now I try to  compile this:
>
> // start of file
> int main(int argc, char *argv[])
> {
> 	// printf("Hello, world\n");
> 	char* cc = new char[10];
> 	delete cc;
> 	return 0;
> }
> // end of file
>
> and get this output:
>
> $ gcc testnewchar.cpp
> /tmp/ccQiKAEK.o(.text+0x26):testnewchar.cpp: undefined reference to `operator new[](unsigned)'
> /tmp/ccQiKAEK.o(.text+0x34):testnewchar.cpp: undefined reference to `operator delete(void*)'
> collect2: ld returned 1 exit status
>
> Pls don't tell me to link explicitly with the C++ lib, I tried -lstdc++ but it doesn't help. I also tried #include <new>,
> #include <new.h> and the like, nothing seems to help.
>
> What do I do wrong?
>

Both replies suggested I use g++ instead of gcc for compilation - which I did, as you can see above.



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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