报错:undefined reference to `OPENSSL_init_ssl'

Errors 同时被 2 个专栏收录
39 篇文章 0 订阅
3 篇文章 0 订阅

报错:

root@ubuntu:/mnt/hgfs/Ubuntu12.04-share/test/2_file/https# gcc -o test test.c  -lcrypto
/tmp/ccmg6lsM.o: In function `sslConnect':
test.c:(.text+0x134): undefined reference to `OPENSSL_init_ssl'
test.c:(.text+0x143): undefined reference to `OPENSSL_init_ssl'
test.c:(.text+0x157): undefined reference to `TLS_client_method'
test.c:(.text+0x15f): undefined reference to `SSL_CTX_new'
test.c:(.text+0x193): undefined reference to `SSL_new'
test.c:(.text+0x1cf): undefined reference to `SSL_set_fd'
test.c:(.text+0x1f2): undefined reference to `SSL_connect'
/tmp/ccmg6lsM.o: In function `sslDisconnect':
test.c:(.text+0x258): undefined reference to `SSL_shutdown'
test.c:(.text+0x268): undefined reference to `SSL_free'
test.c:(.text+0x285): undefined reference to `SSL_CTX_free'
/tmp/ccmg6lsM.o: In function `sslRead':
test.c:(.text+0x37b): undefined reference to `SSL_read'
/tmp/ccmg6lsM.o: In function `sslWrite':
test.c:(.text+0x430): undefined reference to `SSL_write'
collect2: error: ld returned 1 exit status
root@ubuntu:/mnt/hgfs/Ubuntu12.04-share/test/2_file/https#

解决方法: 加上参数 “-lssl

root@ubuntu:/mnt/hgfs/Ubuntu12.04-share/test/2_file/https# gcc -o test test.c  -lcrypto -lssl
root@ubuntu:/mnt/hgfs/Ubuntu12.04-share/test/2_file/https# ls
test  test.c
root@ubuntu:/mnt/hgfs/Ubuntu12.04-share/test/2_file/https# 
  • 2
    点赞
  • 2
    评论
  • 2
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

相关推荐
©️2020 CSDN 皮肤主题: 撸撸猫 设计师:马嘣嘣 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值