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

查看:836
本文介绍了未定义的引用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。
我知道这是不是正确的编码规范,但编辑(类型FILE的对象),是目前一个全局变量。

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天全站免登陆