help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error: undefined reference to


From: Guy Harrison
Subject: Re: Error: undefined reference to
Date: Thu, 04 Nov 2004 02:58:47 GMT
User-agent: KNode/0.7.7

Ben Rennigen wrote:

> Hello,
> 
> when I try to compile my (really small) program,

Post then code then ;-)

> I get the following 
> error:
> 
> /tmp/cchMgpeQ.o(.text+0x24): In function `main':
> : undefined reference to `Complex::Complex[in-charge](float, float)'
> collect2: ld returned 1 exit status
> 
> "Complex" is my class, declared in "complex.h" and implemented in
> "complex.cpp", both files in the same directory with the main cpp file. In
> the main cpp file, I do "include "complex.h"".
> 
> 
> So, what is wrong?

It would appear you've declared...

struct Complex {
 Complex(float,float);
};

...but not supplied the code body (definition). This may be because you've
not written it at all or because you've not passed the object-file/lib
containing the definition to the linker.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]