help-gplusplus
[Top][All Lists]
Advanced

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

Re: Running initial code when in library


From: Paul Pluzhnikov
Subject: Re: Running initial code when in library
Date: Tue, 23 May 2006 17:01:31 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

"Paulo Matos" <address@hidden> writes:

> Your guess is correct. 

I thought so :)

> Verbose output from linker is wierd:

Nothing weird about it ...

> After the .o files:
> attempt to open ../lib/bf/src/.libs/libbf.a succeeded
> attempt to open ../lib/ot/src/.libs/libot.a succeeded
> attempt to open ../lib/fm/src/.libs/libfm.a succeeded
...
> The first lines are the libtool libraries that it
> should be linking and that doesn't seem to be happening... right? Why?

It *is* linking them, but it isn't pulling any objects from them
(or at least not the objects you expect to be pulled),
because nothing in them is in the librarian's *needed* list.

> I'm using the -static flag, what's the problem?

You should *not* be using -static if you want your executable to
run on any systems other then the one it was built on (building
anything with -static is a very bad idea(TM)), but that's completely
orthogonal to your current problem.

> Any ideas on where the problem might be?

The answer above (and understanding and the linker.html I mentioned
earlier). 

GNU-ld specific solution (assuming you really do want all of 
libbf libot and libfm to be included in the executable):

> /bin/sh ../libtool --tag=CXX --mode=link g++  -ggdb -Wall -std=c++98 ...
> esatcluster.o extsat.o esatlogger.o 
  -Wl,--whole-archive
> ../lib/bf/src/libbf.la ../lib/ot/src/libot.la ../lib/fm/src/libfm.la
  -Wl,--no-whole-archive
> ../lib/glpkinterface/src/libglpkinterface.la
> ../lib/ncquest/src/libncquest.la  -lm -lnsl -llog4cpp

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

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