Statically linking libraries in MinGW

前端 未结 3 2105
我在风中等你
我在风中等你 2021-02-06 05:55

Suppose I have three C source files. The first two to be LIBs (lib*.a?), and the third is an application which uses them.

The first is (re.c):

int re(int i         


        
3条回答
  •  失恋的感觉
    2021-02-06 06:12

    Adding to Ghasan's answer. (It is possible to build it static if all the %.a files and object files are available)

    Most of the libraries in mingw are static as I can see in the lib/ directory(all %.a file). In my case the shared-dependencies are only the libstd++-6.dll and libgcc_s_dw2-1.dll which are not there in static library at all.

    I was unable to run my executable without those two shared-libraries. As the description reads,

    This is freely redistributable library; it is required by, (and you must distribute it with), any application compiled by the GNU C++ language compiler, unless support for shared runtime libraries is explicitly disabled when building.

提交回复
热议问题