`
zealotds
  • 浏览: 119680 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

MinGW Dynamic / Static Library Link

    博客分类:
  • c++
阅读更多
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
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics