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

标签 c++ database ubuntu g++ dolphindb

我关注了 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/

相关文章:

c++ - uint8_t 不能用 cout 打印

c++ - Doxygen 没有在 main.cpp 中记录主要功能

c++ - 将 YUYV 拆分为平面的 NEON 优化

Java 桌面应用程序加数据库加互联网

php - 可以使用终端访问 mysql 数据库,但使用 php 时收到 "access denied"消息

c++ - 带有返回值的 if 语句代码样式

javascript - 从 Parse (.com) 查询结果中按字段获取特定对象,无需返回 DB

mysql - 只保留实体 id 而不是 Set<Entity> 来减少连接操作是个好主意吗

ubuntu - make 命令无法识别 .o 文件格式

ubuntu - docker: 无法连接到 Docker 守护进程