使用 OpenSSL-1.1.1g 时 C++/WinRT 项目中出现错误 "A dependent dll was not found"

Error "A dependent dll was not found" in C++/WinRT project while using OpenSSL-1.1.1g

我想使用 OpenSSL-1.1.1g in a C++/WinRT project. So i created a test project。以下是我在这个项目中做了什么:

1.Install C++/WinRT in VS2019

2.Create project "TestOpenSSL1.1.1g" in the directory "c:\temp" (File->New->Project->Blank App(C++/WinRT))

3.Install Strawberry Perl and NASM

4.Download OpenSSL-1.1.1g and extract it to "c:\temp\openssl-1.1.1g"

5.Open "Developer Command Prompt for VS 2019" with "Run as Administrator"

6.Enter the directory "openssl-1.1.1g"

cd c:\temp\openssl-1.1.1g

7.Configure openssl

perl configure VC-WIN32 --prefix="c:\temp\TestOpenSSL1.1.1g\openssl-1.1.1g"

8.Compile openssl

nmake

9.Install openssl

nmake install

10.So i saw the directories "bin" "html" "include" "lib" were created in "c:\temp\TestOpenSSL1.1.1g\openssl-1.1.1g"

11.Include openssl header files

Add "$(ProjectDir)..\openssl-1.1.1g\include" in Solution Explorer->Properties->Configuration properties->C/C++ ->General->Additional include directories

12.Add dependencies "libcrypto.lib" and "libssl.lib"

Add "$(ProjectDir)..\openssl-1.1.1g\lib\libcrypto.lib;$(ProjectDir)..\openssl-1.1.1g\lib\libssl.lib" in Solution Explorer->Properties->Configuration properties->Linker->Input->Additional dependencies

13.Modify MainPage.cpp

#include <openssl/ssl.h>

Add statement "OPENSSL_init();" in function "MainPage::MainPage";

在所有这些之后我构建了 this project, there was no error. but if i debug this project the errors came:

使用openssl and configuring with command "perl Configure VC-WIN32-UWP

的源代码后有效