c++ - g++ 编译错误信息:/usr/bin/ld: 找不到 -lssl
问题描述
我按照教程使用 C++ 连接到 DolphinDB 服务器,并在编译main.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 头文件也丢失了。)
推荐阅读
- twitter - 使用 Twitter 广告 API 创建预定推文
- webkit - 如何为触摸屏启用 wpe webkit 支持
- php - 使用codeigniter php保护托管Linux上的文件夹中的文件
- github - 有没有办法使用 GitHub 操作通过 FTP 从 Windows 服务器中删除文件?
- python - Python 3.8.7 在 Windows 10 中以一种有趣的方式运行
- copy - asp 自动将数据库文件从在线复制或下载到本地电脑
- spring-boot - 没有找到端点映射 Spring-Boot
- swift - 如何使样式选择器完全可触摸
- javascript - 未捕获的异常:Highcharts 中的范围错误未解决
- javascript - Vue组件没有在项目中呈现,没有任何进一步的错误