RE: how could make gcc link static library default?

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

 



Hi,
        You try both static and dynamic linking with following options with example mentioned below:
        If you have want to compile a program test.c which is dependent on 2 static library foo1 and foo2 and one dynamic library foo3 then below mentioned command will do the trick.

        gcc test.c -W1,-Bstatic -lfoo1 -lfoo2 -W1,-Bdynamic -lfoo3 -o test


        Try this trick on any number of static and dynamic libraries.

With Regards,
Anand

-----Original Message-----
From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On Behalf Of net_robber
Sent: Thursday, October 17, 2013 9:10 AM
To: gcc-help@xxxxxxxxxxx
Subject: how could make gcc link static library default?

hi,

i know a option -static to force gcc link static library, which will ignore shared library.
 but in my case, some library just have shared library.
 so, is want gcc linlk static library first, then shared library if static one was not found

how to do that?





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux