3

I followed the tutorial to connect to DolphinDB server with C++ and encounted this error message when compiling 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

Note that my g++ version is above 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.

How to solve this error?

Irene97
  • 50
  • 5

1 Answers1

4

If you want to link against OpenSSL, you need to install the development package for OpenSSL, like this:

apt install libssl-dev

It may also be possible to drop the -lssl from the linker command line. (If there was a project dependency on OpenSSL, the build would not have gotten this far because the OpenSSL header files are missing, too.)

Florian Weimer
  • 32,022
  • 3
  • 48
  • 92