我正在尝试在使用 OpenSSL 1.0.0 的 Ubuntu 10.04 LTS 上构建一些代码。当我运行 make 时,它使用“-lssl”选项调用 g++。来源包括:
#include <openssl/bio.h> #include <openssl/buffer.h> #include <openssl/des.h> #include <openssl/evp.h> #include <openssl/pem.h> #include <openssl/rsa.h>
我跑了:
$ sudo apt-get install openssl Reading package lists... Done Building dependency tree Reading state information... Done openssl is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
但我猜 openssl 包不包含该库。我在制作时收到这些错误:
foo.cpp:21:25: error: openssl/bio.h: No such file or directory foo.cpp:22:28: error: openssl/buffer.h: No such file or directory foo.cpp:23:25: error: openssl/des.h: No such file or directory foo.cpp:24:25: error: openssl/evp.h: No such file or directory foo.cpp:25:25: error: openssl/pem.h: No such file or directory foo.cpp:26:25: error: openssl/rsa.h: No such file or directory
如何在 Ubuntu 10.04 LTS 上安装 OpenSSL C++ 库?
我man g++为 -l 选项做了一个和(在“链接选项”下),它指出:“链接器搜索库的标准目录列表......”和“搜索的目录包括几个标准系统目录......”那些标准的系统目录是什么?
man g++
您要安装开发包,即 libssl-dev:
sudo apt-get install libssl-dev