简体   繁体   中英

GCC error : undefined reference

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?

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

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); .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM