且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

这是什么`ld`错误("未定义的引用")是什么意思?

更新时间:2022-10-23 20:06:08

它告诉你,对于功能的addAll的定义无法找到。请确保您有包含的addAll当你编译/链接的目标文件。

What does this error mean?

/tmp/ccevEqoI.o: In function `main':
funcptr.c:(.text+0x61): undefined reference to `AddALL'
collect2: ld returned 1 exit status

I'm trying to write a function which adds all the integers up to the limit entered by the user.


Transcribed 'answer' which is a comment from the 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.

It tells you that the definition for the function 'AddALL' could not be found. Make sure that you include the object file that contains 'AddALL' when you compile/link.