main.c:(.text+0x7b): undefined reference to

我的main运行不了因为现实undefined reference to“EvaluateExpression” 但是有这个功能不知道为什么,我有两个头文件,除main文件外还有两个文件包含着所有需要的功能
用代码块功能插入代码,请勿粘贴截图

#include <stdio.h>
#include <stdlib.h>

int main()
{
float result = 0.0 ;
char str[200] = "";
printf( "Please input the expression , end the expression with " = " , end the program with "quit" \n" ) ;
while( 1 )
{
scanf( "%s" , str ) ;
if( !strcmp( str , "quit" ) )
{
break ;
}
result = EvaluateExpression( str ) ;
printf( "%s %.2f\n" , str , result ) ;
}
return 0 ;
}
#######main.c:(.text+0x7b): undefined reference to `EvaluateExpression'‘

我的解答思路和尝试过的方法
能够运行

EvaluateExpression这个函数没有定义
改了一下,EvaluateExpression()是计算字符串表达式的值

img

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define maxn 100005
char s[maxn],infixList[maxn][10];
char suffix[maxn][10];
int p=0;
char tmp[maxn];
int p1=0;

//把字符串根据操作数、运算符、括号拆开,存储到infixList数组中
int toInfixExpression(char *s) {
    int tot=0,n=strlen(s);
    for(int i=0;i<n;i++) {
        if(s[i]>='0'&&s[i]<='9') {
            int p=0;
            infixList[tot][p++]=s[i];
            while(i+1<n&&s[i+1]>='0'&&s[i+1]<='9') {
                infixList[tot][p++]=s[++i];
            }
            tot++;
        }else{
            infixList[tot++][0]=s[i];
        }
    }
    return tot;
}

//获得优先级
int getPriority(char c) {
    if(c=='+'||c=='-') return 1;
    else if(c=='*'||c=='/') return 2;
    else return 0; //处理'('的情况
}

//转换成后缀表达式
void parseSuffixExpression(char s[][10],int n) {

    for(int i=0;i<n;i++) {
        if(s[i][0]>='0'&&s[i][0]<='9') {
            strcpy(suffix[p++],s[i]);
        }else if(s[i][0]=='('){
            tmp[p1++]=s[i][0];
        }else if(s[i][0]==')') {
            while(tmp[p1-1]!='(') {
                suffix[p++][0]=tmp[--p1];
            }
            p1--;
        }else{
            while(p1!=0 && getPriority(tmp[p1-1])>=getPriority(s[i][0])){
                suffix[p++][0]=tmp[--p1];
            }
            tmp[p1++]=s[i][0];
        }
     }
     while(p1!=0) {
         suffix[p++][0]=tmp[--p1];
     }
}

//计算一个以字符串形式存储的数的值
int parseInt(char *s) {
    int k=strlen(s);
    int ans=0;
    for(int i=0;i<k;i++) {
        ans=ans*10+(s[i]-'0');
    }
    return ans;
}

//将数k转化成字符串形式存储到指针s开始的地方
void parseString(char *s,int k){
    char b[11];
    int point=0;
    do{
        b[point++]=(char)('0'+k%10);
        k/=10;
    }while(k!=0);
    for(int i=point-1,j=0;i>=0;i--,j++) {
        *(s+j)=b[i];
    }
    *(s+point)='\0';
}

//计算后缀表达式的值
int calculate() {
    int point=0;
    char t[maxn][10];
    int m=1;
    for(int i=0;i<p;i++) {
        int k=strlen(suffix[i]);
        if(suffix[i][0]>='0'&&suffix[i][0]<='9') {
            strcpy(t[point++],suffix[i]);
            t[point-1][k]='\0';
        }else {
            int b=parseInt(t[--point]);
            int a=parseInt(t[--point]);
            int res=0;
            if(suffix[i][0]=='+') {
                res=a+b;
                //printf("(%d) %d + %d = %d\n",m++,a,b,res);
            }else if(suffix[i][0]=='-') {
                res=a-b;
                //printf("(%d) %d - %d = %d\n",m++,a,b,res);
            }else if(suffix[i][0]=='*') {
                res=a*b;
                //printf("(%d) %d * %d = %d\n",m++,a,b,res);
            }else if(suffix[i][0]=='/') {
                if(b==0) {
                    printf("除数为零出错!!!\n");
                    return -1;
                }
                res=a/b;
                //printf("(%d) %d / %d = %d\n",m++,a,b,res);
            }
            parseString(t[point],res);
            point++;
        }
    }
    return parseInt(t[0]);
}
int EvaluateExpression( char str[] )
{
    int ans=calculate();
    return ans; 
}
int main()
{
    float result = 0.0 ;
    char str[200] = "";
    char ch='"';
    printf( "Please input the expression , end the expression with %c = %c , end the program with %cquit%c \n" ,ch,ch,ch,ch) ;
    while( 1 )
    {
        scanf( "%s" , str ) ;
        strcpy(s,str);
        if( strcmp( str , "quit" )==0)
        {
            break ;
        }
        int infixNum=toInfixExpression(s);
        parseSuffixExpression(infixList,infixNum);
        result = EvaluateExpression( str ) ;
        printf( "%s %.2f\n" , str , (float)result ) ;
    }
    return 0 ;
}

main 需要包含这个函数 EvaluateExpression 的头文件才能使用啊,#include包含一下这个头文件就可以了吧

EvaluateExpression 这个函数是在动态库里的吗?如果是的话,需要修改一下环境变量LD_LIBRARY_PATH再执行main