Reputation: 1549
#include "pch.h"
#include <iostream>
#include <openssl\ssl.h>
#include <openssl\err.h>
#include <openssl\conf.h>
int main()
{
SSL_library_init();
SSL_load_error_strings();
}
OpenSSL DLL Throws some errors
Getting the following error after built openssl in vs2017
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol _OPENSSL_init_ssl referenced in function _main
Upvotes: 0
Views: 1175
Reputation: 1549
Source : Building libcurl with SSL support on Windows
Thanks Mr. https://stackoverflow.com/users/519376/vtellier
I have followed the following instructions with slight modifications and it worked fine for VS2017 with latest OpenSSL
In my case follow the curl README file was enough. My configuration is the following:
Visual Studio 2017
Static library
Win64
curl version 7.57.0
OpenSSL 1.0.2
Compilation of libCurl
Download libcurl source there: https://curl.haxx.se/download.html
compress the file and go to the folder curl-7.57.0\projects
Open the README file and follow the instructions, this lead me to do the following:
Downloaded OpenSSL
Extract it and rename it to openssl, put it aside the curl folder, this is important as you'll open the VS project that expect
to find openssl there.
Install Perl
Execute the utility build-openssl.bat to perform the compilation of openSSL. With my settings this became the following:
\build-openssl.bat vc14 x64 release ....\openssl\
just runs .\build-openssl.bat -help to know more about the parameters.
After that you can see OpenSSL has been compiled as you got a new folder here: openssl\build\Win64
Open the Visual Studio project curl-7.57.0\projects\Windows\VC14\curl-all.sln
Be sure to set the visual studio project to the build configuration you need (LIB Release - LIB OpenSSL in my case)
Build all . The library is located at curl-7.57.0\build\Win64\VC14\LIB Release - L
Upvotes: 0
Reputation: 104569
For OpenSSL 1.0, building a program on Windows require linking with libeay32.lib
and ssleay32.lib
. You can find these libraries in the out32dll or out32 folder of your OpenSSL folder depending on how you built it. OpenSSL 1.1 might have a different lib name for these libraries.
Also, if you built these libraries as DLLs, you need to copy over libeay32.dll and ssleay32.dll into the same folder as your EXE or have them in your PATH in order for the program to run.
Upvotes: 0