g++编译错误信息:/usr/bin/ld: 找不到-lssl。

3

我按照教程使用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.

如何解决这个错误?

1
你可能需要安装libssl。 - Paul R
1
顺便提一下,请看看这个答案 - BoBTFish
1个回答

4

如果您想使用OpenSSL进行链接,需要安装OpenSSL的开发包,操作如下:

apt install libssl-dev

从链接器命令行中删除-lssl也是可能的。(如果项目依赖于OpenSSL,构建将无法进行到这一步,因为OpenSSL头文件也丢失了。)


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接