原因:android的stdlib.h中atof是内联的
解决方法:将所有的atof改成strtod
示例代码:
char *strpi = "3.1415";
double dpi;
dpi = atof(strpi); 修改为: dpi = strtod(strpi, NULL);
参考自:http://stackoverflow.com/questions/14571399/Android-ndk-cant-find-atof-function
原文如下:
From stdlib.h in the Android source;
static __inline__ double atof(const char *nptr)
{
return (strtod(nptr, NULL));
}
atof is in other words not a library function, it's an inline function that calls strtod.
If you need to call through loading a library, just use strtod instead.
本文解决了Android NDK中使用atof函数时遇到的问题。由于Android的stdlib.h中atof被定义为内联函数,直接调用会导致链接错误。解决办法是将其替换为strtod函数。
944

被折叠的 条评论
为什么被折叠?



