I would like to use OpenSSL in a VC++ project. But i can not statically link the libraries. Let me first talk about how I did it.
1, Download openssl-1.1.1h.tar.gz and extract it to "d:\openssl\sources\openssl-1.1.1h"
2, Build OpenSSL in Visual Studio 2019 Tools Command Prompt
After built successfully, i found 4 dirs in "d:\openssl\builds\openssl-1.1.1h-VC-WIN32"
And there are two libraries in "d:\openssl\builds\openssl-1.1.1h-VC-WIN32\lib"
3, Create an empty VC++ project in VS2019
4, Add Program.cpp and add codes in Program.cpp
5, Add static libraries by according How to add static libraries to a Visual studio project
Why did it look for "libssl-1_1.dll"? I linked "libssl.lib" statically! I can not find the reason, please help me!
I met "fatal error LNK1120: 28 unresolved externals" if i configure it with "no-shared"
According to Unresolved symbols when built statically for Visual Studio this problem can be solved by add below codes
#pragma comment(lib, "crypt32")
#pragma comment(lib, "ws2_32.lib")
It can be solved according Add dependencies for "ws2_32.lib" and "crypt32.lib"