c++ - 缺少 OpenSSL libcrypto-1_1-x64.dll

标签 c++ openssl g++ runtime-error system-error

我已经开始了一个 C++ 项目,需要实现一些 openssl 库。我下载了这些库,按照有关如何安装 openssl 的说明进行操作。

这很痛苦,由于多种原因不得不多次安装/重新安装。

我终于能够看似正确地安装 openssl 并编译库,将它们与 -libcrypto 和 -libssl 链接,而不是我到处看到的 -lcrypto 和 -lssl。

我已经完成了调试过程,我的包含很好并且实现似乎有效,因为 g++ 找到错误文件并抛出编译错误,但是当它“成功”编译并且我运行 .exe 时,我得到了这个错误。

enter image description here

我搜索了我的 openssl 安装位置,我确实找到了那个文件。

enter image description here

这是我的makefile代码,所有这些位置都清楚地在构建路径中

# *- Makefile -*

compiler=g++
standLib=-lstdc++ -llibcrypto -llibssl
include=-I C:\openssl-1.1.0e\include 
ExtLibrary=-L C:\openssl-1.1.0e        // <--- LOCATION OF THE .dll FILE
outfile=-o main.exe

all : main.o fileReader.o main

clean :
    del *.o *.exe

main: main.o fileReader.o numbers.o
    $(compiler) main.o $(standLib) $(include) $(ExtLibrary) $(outfile)

main.o : main.cpp fileReader.cpp
    $(compiler) -c main.cpp $(standLib) $(include) $(ExtLibrary) 

fileReader.o : fileReader.cpp fileReader.h
    $(compiler) -c fileReader.cpp $(standLib) 

numbers.o : numbers.cpp numbers.h
    $(compiler) -c numbers.cpp $(standlib) 

我错过了什么?感谢您的任何输入或帮助!

**更新**

我发现我可以很好地执行我的程序,只要它在与 libcrypto-1_1-x64.dll 所在的 openssl 相同的目录中运行。

如何构建我的程序,以便它可以在计算机上没有安装 openssl 的情况下自行运行? IE:如果我想把它送给一个没有在他的机器上安装 openssl 的 friend 。

最佳答案

要解决此问题,您只需将 openssl 的 /bin 目录添加到您的路径(使用环境变量)。

关于c++ - 缺少 OpenSSL libcrypto-1_1-x64.dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43124436/

相关文章:

c++ - 子类中的编辑函数

java - 我如何在 Java 中解密 openssl?

c++ - 包含 <algorithm> 时的命名空间 "manufacturing"

c++ - 从派生类中删除虚函数

c++ - 运行时错误 C++ 程序 : glibc detected, munmap_chunk(),无效指针

java - 使用 AndroidHttpClient 的 SSL/TLS 协议(protocol)和密码套件

c++ - g++ 没有生成文件

linux - Cygwin g++ 不允许在 Windows 8 上使用 ./file

c# - 从外部函数 C++ DLL 调用静态函数

c - 使用引擎生成随机数