[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Error: undefined reference to
From: |
Paul Pluzhnikov |
Subject: |
Re: Error: undefined reference to |
Date: |
04 Nov 2004 20:01:32 -0800 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) |
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.
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).
I.e. if libA depends on libB, then -lA should be on the link line
*before* -lB.
To understand why that is so, read this:
http://groups.google.com/groups?selm=qt7B7.4096%24AQ6.384368%40newsread2.prod.itd.earthlink.net
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Re: Error: undefined reference to, Ulrich Eckhardt, 2004/11/04