I know this problem is pretty common. In fact, I searched a lot about the problem but I can't find any solution which fits my case. I'm working in a C++ Visual Studio 2012 project which uses openssl libraries. This is a minimum sample code.
I'm running Visual Studio 2012 Proffesional in a Windows7-64b machine. I downloaded the Win64 OpenSSL v1.0.1e Light installer from slrpowerweb.com and installed it. Then I added to Project Properties-> Configuration Properties-> C/C++-> General-> Additional Include Directories the path "C:\OpenSSL-Win64\include". So by this moment, the sample code is not showing compilation errors in Visual Studio. Then, I also added to the Linker-> Additional library directories, the path "C:\OpenSSL-Win64\lib" and then in Linker-> Additional Dependencies, I added "libeay32.lib;" and "ssleay32.lib". However, when I tried to compile I got this error:
I also tried with the rest of the OpenSSL libraries, because it's possible that SSL_init_function() doesn't belong to "libeay32.lib" or "ssleay32.lib". So I added in the source code :
Those are all the libraries, except the ones which are in the subfolder "VC\static", because the files in static folder have the same name as some of those and it could be a conflict. Anyway, the error it's the same. Oh, I also added the string "C:\OpenSSL-Win64\bin" to the PATH environment variable. And...I also tried by linking to the Win32 OpenSSL which I installed too, and compiling my own "libeay32.lib" and "ssleay32.lib" following a tutorial whose link I'm now allowed to paste . Both, 32b or 64b didn't work.
I'm quite desperate with this, can anyone help me? Thanks!
#include <iostream>
#include <stdio.h>
//OpenSSL
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/x509.h>
using namespace std;
int main(){
SSL_library_init ();
return 0;
}
I'm running Visual Studio 2012 Proffesional in a Windows7-64b machine. I downloaded the Win64 OpenSSL v1.0.1e Light installer from slrpowerweb.com and installed it. Then I added to Project Properties-> Configuration Properties-> C/C++-> General-> Additional Include Directories the path "C:\OpenSSL-Win64\include". So by this moment, the sample code is not showing compilation errors in Visual Studio. Then, I also added to the Linker-> Additional library directories, the path "C:\OpenSSL-Win64\lib" and then in Linker-> Additional Dependencies, I added "libeay32.lib;" and "ssleay32.lib". However, when I tried to compile I got this error:
1>------ Build started: Project: Client, Configuration: Debug Win32 ------
1> Client.cpp
1>Client.obj : error LNK2019: unresolved external symbol _SSL_library_init referenced in function _main
1>c:\users\gabi\documents\visual studio 2012\Projects\Project1\Debug\Client.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I also tried with the rest of the OpenSSL libraries, because it's possible that SSL_init_function() doesn't belong to "libeay32.lib" or "ssleay32.lib". So I added in the source code :
#pragma comment(lib, "libeay32.lib")
#pragma comment(lib, "ssleay32.lib")
#pragma comment(lib, "VC\\libeay32MD.lib")
#pragma comment(lib, "VC\\libeay32MDd.lib")
#pragma comment(lib, "VC\\libeay32MT.lib")
#pragma comment(lib, "VC\\libeay32MTd.lib")
#pragma comment(lib, "VC\\ssleay32MD.lib")
#pragma comment(lib, "VC\\ssleay32MDd.lib")
#pragma comment(lib, "VC\\ssleay32MT.lib")
#pragma comment(lib, "VC\\ssleay32MTd.lib")
Those are all the libraries, except the ones which are in the subfolder "VC\static", because the files in static folder have the same name as some of those and it could be a conflict. Anyway, the error it's the same. Oh, I also added the string "C:\OpenSSL-Win64\bin" to the PATH environment variable. And...I also tried by linking to the Win32 OpenSSL which I installed too, and compiling my own "libeay32.lib" and "ssleay32.lib" following a tutorial whose link I'm now allowed to paste . Both, 32b or 64b didn't work.
I'm quite desperate with this, can anyone help me? Thanks!