gpt4 book ai didi

c++ - g++编译错误信息:/usr/bin/ld: cannot find -lssl

转载 作者:太空狗 更新时间:2023-10-29 21:09:50 27 4
gpt4 key购买 nike

我关注了 tutorial使用 C++ 连接到 DolphinDB 服务器并在编译 ma​​in.cpp 时遇到此错误消息:

$ g++ main.cpp -std=c++11 -DLINUX -DLOGGING_LEVEL_2 -O2 -I../include -lDolphinDBAPI -lssl -lpthread -luuid -L../bin -Wl,-rpath ../bin/ -o main
/usr/bin/ld: cannot find -lssl
collect2: error: ld returned 1 exit status

注意我的g++版本在v6.2以上:

$ g++ --version
g++ (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

如何解决这个错误?

最佳答案

如果你想链接到 OpenSSL,你需要安装 OpenSSL 的开发包,像这样:

apt install libssl-dev

也可以从链接器命令行中删除 -lssl。 (如果项目依赖于 OpenSSL,构建就不会走到这一步,因为 OpenSSL 头文件也丢失了。)

关于c++ - g++编译错误信息:/usr/bin/ld: cannot find -lssl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56965416/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com