help-gplusplus
[Top][All Lists]
Advanced

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

Re: Linking statically


From: Thobias Vakayil
Subject: Re: Linking statically
Date: Wed, 11 Jan 2006 11:38:53 +0530
User-agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.6) Gecko/20040116

T wrote:

Hi,

I haven't involved in C programming for quite a while. I want to confirm
this question but couldn't find in comp.lang.c FAQ, and GCC Frequently
Asked Questions. Anyway, here is the question:

How can I link a lib statically?

Although the question is simple, please answer comprehensively. I.e., what
is the command line format, what is required for the linking.
Specifically, I want to link avcodeccvs & avformat statically while lz is
linked dynamically. how can I do that? This is what I tried:

$ g++ -g -Wall -o lnk-test lnk-test.C -lz -static -lavcodeccvs -lavformat
/usr/bin/ld: cannot find -lavcodec
collect2: ld returned 1 exit status

Please note, this is ok:

$ g++ -g -Wall -o lnk-test lnk-test.C -lavcodec -lavformat -lz

Further, in the libavcodeccvs-dev package, only .so type of libs are
provided:

/usr/lib/libavcodec.so
/usr/lib/libavformat.so

please elaborate. Thanks

tong

Use the option -Bstatic in g++ for linking the libraries statically.

Regards,

Thobias Vakayil



reply via email to

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