Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-04-17 13:12:17


rrdn60_at_[hidden] wrote:
>
> Here is what is currently causing the problem:
>
> % g++ abc_sl.o -shared -fpic -L../apikit/lib/hppa8000 -lAbc
> -lboost_python -lcl -ldld -lm -o abc_sl.sl
>
> % g++ -shared -fpic -L../apikit/lib/hppa8000 -lAbc -lboost_python -lcl
> -ldld -lm -o abc_sl.sl abc_sl.o
>
> Question: Which one is "correct"?

On Unix, the order of object files and libraries in a linker
command line is usually important, because external symbols
are only searched for in libraries occurring later on the
command line. Thus, the second invocation looks highly
suspicious to me, because the main object file is the last
one on the command line. I'd put object files first.

It is irrelevant where the output file ("-o") is defined, but it
strikes me as odd to put it at the end.

g++ -o outputfile -flags abc_sl.o libraries

seems much more pleasant for my eyes.

The reason that your second variant of linker invocation
produces a non-working executable may be due to the fact
that vital exception-handling symbols are not resolved
in one of the libraries mentioned on the command line, but
somewhere else where they're inappropriately defined for
C++ use.

Jens Maurer


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk