samedi 29 octobre 2016

Strange Behavior of G++ in Ubuntu 14.04.5

recently I'm trying to use Apache Ant with g++4.8 with -std=c++11.

If I tried this code it passed.

#include <cmath>
...
sqrtf((float)100);

However, if I type

#include <cmath>
...
sqrt((float)100);

The g++ compiler will produce the error,

/usr/bin/ld: test.o: undefined reference to symbol 'sqrtf@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Adding -lm doesn't help either. Any ideas?

Thanks!

Aucun commentaire:

Enregistrer un commentaire