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

_______________________________________________
Help-gplusplus mailing list
Help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to