Mail Archives: djgpp/2000/03/07/18:46:04
On Wed, 8 Mar 2000, Lonnie Lee wrote:
> Below is a code that does not work:
>
> /* Program to Calculate the product of two numbers. */
> #include <stdio.h>
>
> int a,b,c;
>
> int product(int x, int y) ;
<snip>
> /* Function returns the product of the two values provide */
> int pruduct(int x, int y)
^^^^^^^^^^^^^^^^^^^^ Here is the problem, earlier a function called
product has being defined but here the function name is misspelled as
pruduct (_note_ the letter u instead of the letter o). So just change this
to product (with the letter o) and every thing should be alright.
> {
> return (x * y);
> }
> OK you can "compile" no problem but when you go to build it you get an
> error.
> "undefined reference to 'product'"
This is because the linker is searching for a function called "int
product(int x,int y)" (without the quotes) but it can't find it.
The reason is that you have misspelled product as pruduct and as a result
the linker can find a function called pruduct but _not_ product, therefore
the linker informs you that it can't find a function called product to
link in.
> If anyone could help I would appreciate it. If there is a site or newsgroup
> where I need to go that would be great. Because I am tring to learn it woul
I think the newsgroup comp.lang.c would be of great assistance to you as
this newsgroup is more towards discussion about DJ's port of the GNU C
compiler.
Grendel
Hi, I'm a signature virus. plz set me as your signature and help me spread
:)
- Raw text -