#define _GNU_SOURCE
#include <string.h>
char *strcasestr(const char *haystack, const char *needle);
strcasestr函数用于在字符串haystack中查找字符串needle,忽略大小写。如果找到则返回needle字符串在haystack字符串中第一次出现的位置的char指针。
在使用中不加上#define _GNU_SOURCE,编译时会出现warning: assignment makes pointer from integer without a cast。
这是因为函数的声明在调用之后。未经声明的函数默认返回int型。
因此要在所有头文件之前加#define _GNU_SOURCE,以此解决此问题。