问题
I have downloaded the latest release version of Openssl from http://www.openssl.org/source/
I would like to use it in Visual Studio 2012, especially getting the md5/sha-1 hash of a file, but I can not include / setup the environment with the openssl library. To be honest I got confused what to include, and where, however I have read the README-s.
I'm getting this error.
Error 1 error LNK2019: unresolved external symbol _MD5_Init referenced in function _main
So my question is, I have downloaded the latest release (openssl-1.0.1e.tar.gz), what should I config in VS2012 to be able to use the lib? Thanks!
UPDATE
This question helped me also in finding the solution. Boost SSL with Visual Studio 2010 and OpenSSL
The steps required to use the openSSL lib with VS2012:
- download and install a version (I have 64bit OS, however I installed 32bit openssl) from http://slproweb.com/products/Win32OpenSSL.html.
- New project in VS, then Configuration Properties/C/C++/General/Additional Include Directories: openssl include folder (C:\OpenSSL-Win32\include)
- Linker/General/Additional Library Directiories: C:\OpenSSL-Win32\lib
- Linker/Input/Additional Dependencies :
libeay32.lib libeay32MTd.lib libeay32MT.lib libeay32MDd.lib libeay32MD.lib ssleay32.lib ssleay32MTd.lib ssleay32MT.lib ssleay32MDd.lib ssleay32MD.lib
(It was written that I need to only add that one which matches with C/C++/Code Generation/Runtime Library, but It works me this way.)
- Copy theese files into current VS folder /VC/lib
回答1:
What compiler did you use to compile OpenSSL? Did you use MinGW? If so, make sure you don't strip them (or just with --strip-unneeded) otherwise import symbols will be stripped. Do the header and lib version match?
Maybe you want to try pre built ones from: http://slproweb.com/products/Win32OpenSSL.html those work for sure.
来源:https://stackoverflow.com/questions/17127824/using-openssl-in-visual-studio-2012