这个错误是什么意思?
/tmp/ccevEqoI.o: In function `main':
funcptr.c:(.text+0x61): undefined reference to `AddALL'
collect2: ld returned 1 exit status
我正在尝试编写一个将所有整数相加到极限的函数 由用户输入。
转录的“答案”是来自 OP 的评论:
I wrote a program that would add all the integers upto the limit Specified. For that I had to write a function. So I made a function called 'AddAll' but when I called it from my program I called it as 'AddALL'.
Note: C is case sensitive. Eventually when I changed the name of the function where I was calling it. It compiled perfectly :)
Just thought that this piece of info would be useful to beginners.
最佳答案
这意味着链接器(在 gcc 中称为 ld
)没有在指定的目标文件中找到符号 AddALL
。基本上,该函数没有主体,或者它是一个声明为 extern
且没有定义的变量。
关于c - 这个 `ld` 错误 ("undefined reference") 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3572043/