对 stricmp 的未定义引用 [英] undefined reference to stricmp

查看:36
本文介绍了对 stricmp 的未定义引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to create a method that finds and replaces a string within a string but I seem to have some error at compile time with it. Could I get some help into figuring out what is going on?

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);
    }       
}

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

the error I get at compile time is undefined reference to stricmp. I know it isn't proper coding convention, but edit (object of type FILE) is currently a global variable.

推荐答案

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

stricmp is Windows-specific. If you're not on Windows, strcasecmp.

这篇关于对 stricmp 的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆