Re: g++ : compiling *some* libraries as static, others as dynamic

gcc, to my knowledge, will always try and link against the dynamic library even if the static library exists and you ask it to use the static lib.

The command that you are suppose to use would be something like:

Code:

g++ file.cpp -o out -static -lX11 -dynamic -lm

which is suppose to statically link libX11 and dynamically link libm, but I'm pretty sure gcc would still link X11 dynamically.

Good luck.

When I invented the Web, I didn't have to ask anyone's permission.
~Tim Berners-Lee on Net Neutrality
-------------------------------------
Visit the Ubuntu Programming IRC-channel at #ubuntu-programming (chat.freenode.net).

Re: g++ : compiling *some* libraries as static, others as dynamic

for older compiler/linkers, the rule was that the command line entries before the
source were dynamic; after the source only static would be linked. In more
recent tools, you need to look at the linker used, and its keywords: -Bdynamic -Bstatic
and others. The keyword governs for all libraries following it. "info ld" should
give the details.
Gerald