1.freelocale未定义
问题编译错误提示:
stdsoap2.c:7468:对‘freelocale’未定义的引用 stdsoap2.c:7468:对‘freelocale’未定义的引用 stdsoap2.c:7468:对‘freelocale’未定义的引用 stdsoap2.c:16684:对‘strtod_l’未定义的引用 stdsoap2.c:16684:对‘newlocale’未定义的引用
把stdsoap2.h中的这个定义注释掉即可:
# elif defined(__GLIBC__) || defined(__GNU__) || defined(__GNUC__) # define HAVE_POLL # define HAVE_SNPRINTF # define HAVE_STRRCHR # define HAVE_STRTOD # define HAVE_SSCANF # define HAVE_STRTOD_L # define HAVE_SSCANF_L # define HAVE_STRTOL # define HAVE_STRTOUL # define HAVE_STRTOLL # define HAVE_STRTOULL # define HAVE_GETTIMEOFDAY # define HAVE_SYS_TIMEB_H # define HAVE_FTIME # define HAVE_RAND_R # define HAVE_GMTIME_R # define HAVE_ASCTIME_R # define HAVE_LOCALTIME_R # define HAVE_STRERROR_R # define HAVE_TIMEGM # define HAVE_WCTOMB # define HAVE_MBTOWC # define HAVE_ISNAN # define HAVE_ISINF # if !defined(__GNUC__) || __GNUC__ >= 4 /* gcc 3 and earlier often refuse to compile _l functions */ # define HAVE_STRTOD_L # define HAVE_SSCANF_L //# define HAVE_LOCALE_H //注释掉解决freelocale未定义问题
2.__isnan等等未定义
stdsoap2.c:(.text+0x6194): warning: gethostbyname_r is obsolescent, use getnameinfo() instead. /tmp/ccqD1Pz1.o: In function `soap_float2s': stdsoap2.c:(.text+0x19a80): undefined reference to `__isnan' stdsoap2.c:(.text+0x19ad0): undefined reference to `__isnanf' stdsoap2.c:(.text+0x19af4): undefined reference to `__isnanf' stdsoap2.c:(.text+0x19b44): undefined reference to `__isnanf' stdsoap2.c:(.text+0x19b68): undefined reference to `__isnanf' /tmp/ccqD1Pz1.o: In function `soap_double2s': stdsoap2.c:(.text+0x1a378): undefined reference to `__isnan' stdsoap2.c:(.text+0x1a3cc): undefined reference to `__isnan' stdsoap2.c:(.text+0x1a3f8): undefined reference to `__isnan' stdsoap2.c:(.text+0x1a44c): undefined reference to `__isnan' stdsoap2.c:(.text+0x1a478): undefined reference to `__isnan' collect2: ld returned 1 exit status
加上连接库 -lm 就可以编译通过了;