Jump to ID:
Core Development Tools

Project Home

Documents

Source Code

Discussions

Wiki

Project Info
Forum Topic - Why g++ work but gcc not ?: Page 2 of 2 (2 Items)
   
 
 
Re: Why g++ work but gcc not ?  
bogdan celer wrote:
> # qcc -o test3 test3.c
> test3.o: In function `main':
> test3.c:(.text+0x21): undefined reference to `_Dclass'
> cc: /usr/qnx641/host/qnx6/x86/usr/bin/ntox86-ld error 1
> # i386-pc-nto-qnx6.4.0-gcc-4.3.3 -o test3 test3.c
> /tmp/cc4tq5Lv.o: In function `main':
> test3.c:(.text+0x2b): undefined reference to `_Dclass'
> collect2: ld returned 1 exit status
> #
> but g++ work
> # i386-pc-nto-qnx6.4.0-g++-4.3.3 -o test3 test3.c
> # ./test3
> a 2.000000 is a number
> #
> The same results is with gcc/g++4.4.2

You need to link against libm (-lm). g++ works because it implicitly 
links in libm to resolve libstdc++-v3.

Regards,

Ryan Mansfield