致命错误:openssl/ssl.h:没有这样的文件或目录

fatal error: openssl/ssl.h: No such file or directory

本文关键字:文件 openssl ssl 致命错误      更新时间:2023-10-16

我来自Python,刚接触C++,正在尝试测试一个通过websockets检索数据的程序。

我复制了这个 github 存储库

  git clone https://github.com/tensaix2j/binacpp

正在尝试运行该示例,因此我填写了 api 密钥和秘密:

 /binacpp/example/example.cpp

现在从/binacpp/示例文件夹我正在尝试

make example

我收到此错误:

Making example

g++ -I../lib/libcurl-7.56.0/include -I../lib/jsoncpp-1.8.3/include -I../lib/libwebsockets-2.4.0/include -I../lib/libbinacpp/include 
example.cpp 
-L../lib/libcurl-7.56.0/lib 
-L../lib/libwebsockets-2.4.0/lib 
-L../lib/libbinacpp/lib 
-lcurl -ljsoncpp  -lcrypto -lwebsockets -lbinacpp -o example
In file included from ../lib/libbinacpp/include/binacpp_websocket.h:16:0,
                 from example.cpp:8:
../lib/libwebsockets-2.4.0/include/libwebsockets.h:214:10: fatal error: openssl/ssl.h: No such file or directory
 #include <openssl/ssl.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
Makefile:25: recipe for target 'example' failed
make: *** [example] Error 1
user@ip:/opt/binacpp/example$ ^C
user@ip:/opt/binacpp/example$ ./example.run.sh
./example: error while loading shared libraries: librtmp.so.0: cannot open shared object file: No such file or directory

试图弄清楚为什么我会收到此错误以及如何处理它?

1(自述文件中说依赖项是

  jsoncpp-1.8.3
  libcurl-7.56.0
  libwebsockets-2.4.0

但是,这些都包含在存储库中

2(如果假设OpenSSL通常已经安装,我怎么知道要安装哪个版本?我该如何安装它,因为使用 Python,您只需使用 pip,所有内容都将放置在正确的目录中,以将其包含在您的程序中。

看起来没有安装 openssl 的开发包:

https://stackoverflow.com/a/3016986/5147260