undefined reference to error解决方法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了undefined reference to error解决方法相关的知识,希望对你有一定的参考价值。
#include<stdio.h>
typedef struct
char Data[100];
int top;
Stack;
int compare(char a, char b);
void Push1(Stack *s, char element);
char Pop1(Stack *s);
int main()
int i = 0, j = 0;
char expression[20], exp2[20], popChar;
Stack stack, *Ptr = &stack;
stack.top = -1;
printf("input the expression:");
scanf("%s", expression);
while(expression[i] != '\0')
if(expression[i] == ' '|| expression[i] =='\t')
i++;
continue;
else if(expression[i] == 0||expression[i] == 1||expression[i] == 2||expression[i] == 3||expression[i] == 4
||expression[i] == 5||expression[i] == 6||expression[i] == 7||expression[i] == 8||expression[i] == 9
||expression[i] == 10)
printf("%c", expression[i]);
else if(expression[i] == '(')
push1(Ptr, expression[i]);
else if(expression[i]==')')
while(1)
popChar = pop1(Ptr);
if(popChar != '(')
printf("%c", popChar);
else
break;
else if(expression[i] == '+'||expression[i] == '-'||expression[i] == '*'||expression[i] == '/')
if(compare(expression[i], Ptr->Data[Ptr->top]))
push1(Ptr, expression[i]);
else
printf("%c", pop1(Ptr));
while(compare(Ptr->Data[Ptr->top], expression[i]))
printf("%c", pop1(Ptr));
push1(Ptr, expression[i]);
i++;
while(Ptr->top != -1)
printf("%c", pop1(Ptr));
return 0;
void Push1(Stack *s, char element)
if(s->top == 100 - 1)
printf("full");
return;
else
s->Data[++(s->top)] = element;
char Pop1(Stack *s)
return s->Data[(s->top)--];
int compare(char a, char b)
if((a == '*'||a == '/') && (b == '+'||b == '-'))
return 1;
else
return 0;
这两个函数都是在同一个文件中定义的,为什么说没定义。百度了一下,看不懂,
我用的devc++,MINGW GCC 4.8.1 ,
char Pop1(Stack *s);
您定义的函数首字符都是大写的。而调用里面的写成了push1和pop1,小写的了。本回答被提问者和网友采纳 参考技术B 你的代码函数首字母是大写的,而错误的这些都是首字母小写的...
void Push1(Stack *s, char element);--声明
push1(Ptr, expression[i]);-----引用,
undefined reference to symbol '_ZNK11GenICam_3_016GenericException17GetSourceFileNameEv'(示例代
今天在编译DALSA二次开发的源码时,出现了如下错误:
/usr/bin/ld: ./out/camera.o: undefined reference to symbol ‘_ZNK11GenICam_3_016GenericException17GetSourceFileNameEv‘
//opt/genicam_v3_0/bin/Linux64_x64/libGCBase_gcc421_v3_0.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
需要的库都(libGevApi)添加到makefile中去了,结果还是有这个错误出现。
经添加库 libGCBase_gcc421_v3_0.so 问题解决。
makefile中添加信息如下:
以上是关于undefined reference to error解决方法的主要内容,如果未能解决你的问题,请参考以下文章
ubuntu下调试ffmpeg程序出现undefined reference to pthread_once ,undefined reference to uncompress错误
undefined reference to `err_quit' ; undefined reference to `err_sys’是什么错误?