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

时间:2019-07-10 07:22:30

标签: c++ ubuntu g++ dolphindb

我跟随tutorial使用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 个答案:

答案 0 :(得分:3)

如果要链接到OpenSSL,则需要安装OpenSSL开发包,如下所示:

apt install libssl-dev

也有可能从链接器命令行中删除-lssl。 (如果存在对OpenSSL的项目依赖关系,那么由于OpenSSL头文件也丢失了,构建将不会走得那么远。)

相关问题