CodeBlocks使用静态链接库

想写一个curl下载工具,批量保存页面中的图片或其他资料的脚本工具。

但在公司写好了之后,在家里不能运行。于是就上网搜索了一大圈,找到设置CodeBlocks使用静态链接库的方法。

  •  Go to Project build options->Compiler settings->#defines: type in CURL_STATICLIB. When this is defined the libcurl.h header will have its function signatures preprocessed to fit static linkage. Otherwise dynamic linkage is assumed and the mangled names then become _imp__*. The unresolved errors from your screenshot indicate it's attempting a dynamic link rather than the desired static link.

  • Under Project build options->Linker settings->Link libraries make sure it contains the following: curl, rtmp, idn, ssl, ssh2, crypto, z, ws2_32, wldap32, winmm, gdi32. Note that order is important. Due to a design deficiency of the gnu linker, the most dependant libraries need to be listed first followed by least dependant. Other linkers like msvc link and borland's ilinker do not exhibit such issues -- the libraries can be listed in any order.
  • Under Project build options->Linker settings->Other linker options add in '-static'. This will make sure that the static version of 'idn' is used. If this switch is omitted then your compiled program could depend on 'libidn-11.dll' to run which probably isn't what you want.


转载于:https://www.cnblogs.com/bouygues/archive/2013/03/01/4479993.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值