1. 程式人生 > >Android ndk cannot locate symbol "atof" referenced by的解決方法

Android ndk cannot locate symbol "atof" referenced by的解決方法

原因:android的stdlib.h中atof是內聯的

解決方法:將所有的atof改成strtod

示例程式碼:

  char *strpi = "3.1415";

  double dpi;

  dpi = atof(strpi);     修改為: dpi = strtod(strpi, NULL);

原文如下:

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.