MinGW Dynamic / Static Library Link

By default MinGW gcc links your program with shared library(to make sure you can use VS toolkit "depends.exe" to check the dependency although it may claims some errors).
默认情况下,MinGW GCC 使用动态连接库连接你的程序。你可以用过VS的depends.exe工具检查程序依赖,虽然会报一些错误但不影响使用。

// to explicitly link with shared library (default case)
// 显式使用动态链接库链接
g++ -shared-libgcc -o t.exe t.cpp

// to explicitly link with static library
// add "-static-libstdc++" if you use std
/// 显式使用静态链接库链接,如果使用了std还需要加上"-static-libstdc++"
g++ -static-libgcc -o t.exe t.cpp


By using shared MinGW libraries you may need to copy the dependent lib binaries to your app's deployment path. In my MinGW version the files are located at:
如果使用了动态MinGW库进行链接,你的程序在发布时需要将MinGW的动态链接库一同发布,在我使用的MinGW版本中这两个库如下:
/mingw/bin/libgcc_s_dw2-1.dll
/mingw/bin/libstdc++-6.dll



For detailed information please check the Mingw GCC document:
更多信息可以参考MinGW GCC的文档:
man gcc
# and search "-static-libgcc" in it
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值