El siguiente programa no se puede compilar en gcc. Pero compila OK con g ++ y MSC++ con la extensión .c
.a gcc sqrt function bug?
#include <math.h>
#include <stdio.h>
int main()
{
double t = 10;
double t2 = 200;
printf("%lf\n", sqrt(t*t2));
return 0;
}
Mi sistema es CentOS, la información de la versión.
> gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
La información de error:
> gcc test.c
/tmp/ccyY3Hiw.o: In function `main':
test.c:(.text+0x55): undefined reference to `sqrt'
collect2: ld returned 1 exit status
Es esto un error?
¿Alguien puede hacer una prueba por mí?
Véase también http://stackoverflow.com/questions/1033898 – ephemient