开发者

What does this `ld` error ("undefined reference") mean?

开发者 https://www.devze.com 2023-01-13 07:20 出处:网络
What does this error mean? /tmp/ccevEqoI.o: In function `main\': funcptr.c:(.text+0x61): undefined reference to `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. Event开发者_C百科ually 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 means that the linker (that is called ld in gcc) did not found the symbol AddALL in the specified object files. Basically, there is no body for that function or it's a variable declared as extern with no definition.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消