|
From: | Karthik Kumar |
Subject: | Re: Error: undefined reference to |
Date: | Thu, 04 Nov 2004 23:51:19 -0800 |
User-agent: | Mozilla Thunderbird 0.8 (Windows/20040913) |
Paul Pluzhnikov wrote:
Karthik Kumar <kaykaylance_nospamplz@yahoo.com> writes:g++ -o prog_complex complex.cpp prog_complex.cpp ... The GNU linker expects the symbols to be arranged this way. The most independent library comes first. The least independent library comes last.First off, there is not a single *library* on your command line, and the order of sources and objects doesn't matter at all: they *all* are included in the final link.
Well - I agree there is not any library file. But the op had mentioned in the first post of the thread that complex.cpp contains the implementation of complex class. And prog_complex.cpp uses that.
Second off, you got your advice completely backwards: libraries should occur on command line from *most* dependent to *least* dependent (which is usually libc and is added by the compiler driver at the end).
Oops ! Apologies for the mistake. Thanks for pointing out the same. To the *op*, it got to be - g++ -o prog_complex prog_complex.cpp complex.cpp . -- Karthik. http://akktech.blogspot.com . ' Remove _nospamplz from my email to mail me. '
[Prev in Thread] | Current Thread | [Next in Thread] |