undefined reference to `SSL_library_init'错误

编译过程中出现以下错误

[root@localhost apps]#g++ -o clientclient.o

client.o: In function `main':

client.cpp:(.text+0x15): undefinedreference to `SSL_library_init'

client.cpp:(.text+0x1a): undefinedreference to `TLSv1_client_method'

client.cpp:(.text+0x22): undefinedreference to `SSL_load_error_strings'

client.cpp:(.text+0x2d): undefinedreference to `SSL_CTX_new'

client.cpp:(.text+0x5d): undefinedreference to `SSL_CTX_set_verify'

client.cpp:(.text+0x13e): undefinedreference to `SSL_new'

client.cpp:(.text+0x165): undefinedreference to `SSL_set_fd'

client.cpp:(.text+0x170): undefinedreference to `SSL_connect'

client.cpp:(.text+0x186): undefinedreference to `ERR_print_errors_fp'

client.cpp:(.text+0x19d): undefinedreference to `SSL_get_current_cipher'

client.cpp:(.text+0x1a5): undefinedreference to `SSL_CIPHER_get_name'

client.cpp:(.text+0x1dc): undefinedreference to `SSL_write'

client.cpp:(.text+0x1f2): undefinedreference to `ERR_print_errors_fp'

client.cpp:(.text+0x21b): undefinedreference to `SSL_read'

client.cpp:(.text+0x231): undefinedreference to `ERR_print_errors_fp'

client.cpp:(.text+0x270): undefinedreference to `SSL_shutdown'

client.cpp:(.text+0x28e): undefinedreference to `SSL_free'

client.cpp:(.text+0x299): undefinedreference to `SSL_CTX_fre

解决方法找不到相应的库

gcc -Wall  client.c -lssl -lcrypto -o client

其中-l是指加入的某个库的意思,-lssl 表示加入的库是libssl.so或者是libssl.a的意思,其中lib和扩展名可以不写

至于搜索路径可以-L/lib -L/usr/lib  其中-L/path是搜索路径的意思,可以用find / -name libssl.*查找下在哪个路径下

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
undefined reference to shm_init'错误是由于编译器无法找到对应的库函数shm_init引起的。要解决这个问题,可以尝试以下几个步骤: 1. 确保你的代码中包含了正确的头文件,即包含shm_init函数的头文件。 2. 检查你的代码是否正确地链接了对应的库文件。你可以使用-l参数来链接库文件,比如-lpthread用于链接pthread库。在编译时,确保加上正确的链接参数。 3. 确保你的系统上已经安装了包含shm_init函数的库文件。如果没有安装,可以尝试安装相关的开发包。 总结起来,要解决undefined reference to shm_init'错误,你需要确认代码包含正确的头文件,正确地链接库文件,并确保相关的库文件已经安装在系统中。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [Linux C语言编译报错:undefined reference to `sem_init‘(编译时加 -lpthread)](https://blog.csdn.net/Dontla/article/details/126366430)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [linux下编译c代码时error:undefined reference to sem_init sem_wait 解决方法之一](https://blog.csdn.net/loosen17/article/details/50524743)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值