对stricmp的未定义引用

Jon*_*han 9 c arrays replace file char

我正在尝试创建一个方法来查找并替换字符串中的字符串,但我似乎在编译时遇到了一些错误.我能找到一些帮助来弄清楚发生了什么吗?

void replaceString(char *find, char *replace)
{
    int len_string,i;
    char temp[30];
    len_string=strlen(find);
    while(1)
    {
        for(i=0;i<len_string;i++) temp[i]=fgetc(edit);
            temp[i+1]=NULL;
        /* the stricmp() is used for comparing both string. */
        if(stricmp(find,temp)==0)
        {
            fprintf(edit,"%s ",replace);
            fclose(edit);
            exit(1);
        }
        fseek(edit,-(len_string-1),1);
    }       
}
Run Code Online (Sandbox Code Playgroud)

我在编译时得到的错误是对stricmp的未定义引用.我知道它不是正确的编码约定,但编辑(FILE类型的对象)当前是一个全局变量.

bma*_*ies 27

stricmp是特定于Windows的.如果你不在Windows上,strcasecmp.

  • 不仅是Windows特定的,而且特定于Microsoft的编译器/库.我不认为你会在Windows的其他编译器中找到它. (6认同)
  • `strncasecmp` 也是 `strnicmp` 的等效替代品。 (2认同)