Pregunta

I am trying to compile some C code on a beagleboard xm. I try to compile, but I get the error: undefined reference to 'isfinite' which is in the math.h library. This code compiles perfectly in all my other computers, and I do include -lm in my makefile.

I suspect that it may be my compiler, maybe it is an over version? On the beagleboard it's version 4.3.3, but on my computer it's 4.7.3, but I don't know how to get a later version. I thought opkg would automatically get the latest available.

Any ideas why this may be happening?

¿Fue útil?

Solución

The function infinite() is part of C99. Your compiler is by default using an older version of the C language. You need to compile with the the flag -std=c99 to enable this macro.

`gnu89' GNU dialect of ISO C90 (including some C99 features). This is the default for C code.

http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/C-Dialect-Options.html

Otros consejos

isfinite is part of the C++11 standard and gcc 4.3.3 is to old to know that. Try int finite(double x); or int finitef(float x);.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top