Compiler errors 对lrint的未定义引用
我正试图使用此链接中的说明编译和构建一组特定的无线驱动程序 当我安装几个模块时,这是我得到的错误Compiler errors 对lrint的未定义引用,compiler-errors,int,embedded-linux,drivers,texas-instruments,Compiler Errors,Int,Embedded Linux,Drivers,Texas Instruments,我正试图使用此链接中的说明编译和构建一组特定的无线驱动程序 当我安装几个模块时,这是我得到的错误 /root/build-utilites/fs/lib/libnl-3.a(utils.o): In function `nl_prob2int': /root/build-utilites/src/libnl/lib/utils.c:378: undefined reference to `lrint' collect2: ld returned 1 exit status make: *** [
/root/build-utilites/fs/lib/libnl-3.a(utils.o): In function `nl_prob2int':
/root/build-utilites/src/libnl/lib/utils.c:378: undefined reference to `lrint'
collect2: ld returned 1 exit status
make: *** [all] Error 1
****** ERROR 0 *******
这就是函数nl_prob2int(在/root/build utilites/src/libnl/lib/中)的样子
long nl_prob2int(const char *str)
{
char *p;
double d = strtod(str, &p);
if (p == str)
return -NLE_INVAL;
if (d > 1.0)
d /= 100.0f;
if (d > 1.0f || d < 0.0f)
return -NLE_RANGE;
if (*p && strcmp(p, "%") != 0)
return -NLE_INVAL;
return rint(d * NL_PROB_MAX);
}
long nl_prob2int(const char*str)
{
char*p;
双d=strtod(str和p);
如果(p==str)
返回-NLE_INVAL;
如果(d>1.0)
d/=100.0f;
如果(d>1.0f | | d<0.0f)
返回-NLE_范围;
如果(*p&&strcmp(p,“%”)!=0)
返回-NLE_INVAL;
返回打印(d*NL_PROB_MAX);
}
以下库包含在utils.c代码中
#include <netlink-private/netlink.h>
#include <netlink/netlink.h>
#include <netlink/utils.h>
#include <linux/socket.h>
#include <stdlib.h> /* exit() */
#include <math.h>
#包括
#包括
#包括
#包括
#include/*exit()*/
#包括
libnl依赖于libm,但它们在链接器命令行中的顺序不正确。(-lnl应在-lm之前)
然而,这只体现在较新版本的GCC中。。。。您可能在链接器命令行中有“-Wl,--as-needed”标志。删除它。libnl依赖于libm,但它们在链接器命令行中的顺序不正确。(-lnl应在-lm之前)
然而,这只体现在较新版本的GCC中。。。。您可能在链接器命令行中有“-Wl,--as-needed”标志。拆下它。有人能帮我吗?有人能帮我吗?