所以我通读了其他问题,他们被告知在放入任何文件之前先放上#define _GNU_SOURCE
,它会起作用,但它对我不起作用。我也尝试加入#define _GNU_SOURCE char *strcasestr(const char *haystack, const char *needle);
,但仍然无法正常工作。我找不到任何其他的东西,也许任何人都可以帮忙?提前致谢。strcasestr仍然不能正常工作
错误:函数“strcasestr”
/**
*
* Description: This is code for Lab 3 Task 2.
* Reads data from file and gives opportunity to search by cities
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
printf("Please input the city you want to find employees in:");
scanf("%s", input);
maxline = i;
for (i = 0; i <= maxline; i++) {
if (strcasestr(employee[i].city, input) != 0) { // PROBLEM
printf("%d %s %s %s\n", &employee[i].ID, employee[i].fn,
employee[i].ln, employee[i].city);
amount++;
}
}
printf("%d matches out of %d members", amount, maxline);
return 0;
}
你在Linux上吗? – Barmar
@Barmar不,在窗口上 – Quto
你在使用什么c库? 'Linux'上的'glibc'? – ventiseis