I. Compile OpenSSL
Install Perl correctly before compiling OpenSSL, because you need to use this program when compiling OpenSSL.
Download the latest Perl: Latest. Then install it.
Download the latest version of OpenSSL: http://www.openssl.org/source/openssl-0.9.8g.tar.gz
Then release the source code in the C: \ openssl-0.9.8g directory.
Go to the OpenSSL source code directory.
C: \ openssl-0.9.8.g
The following describes the execution process of Install. w32 in the directory:
Run configure:
Perl configure VC-WIN32 -- prefix = C:/OpenSSL
Create a makefile:
Ms \ do_ms
Compile the dynamic library:
Nmake-F Ms \ NTDLL. Mak
Compile the static Library:
Nmake-F Ms \ nt. Mak
Test dynamic library:
Nmake-F Ms \ NTDLL. Mak Test
Test static Library:
Nmake-F Ms \ nt. Mak Test
Install dynamic library:
Nmake-F Ms \ NTDLL. Mak install
Install static Library:
Nmake-F Ms \ nt. Mak install
Clear the compilation of the last dynamic library for recompilation:
Nmake-F Ms \ NTDLL. Mak clean
Clear the previous static library compilation for recompilation:
Nmake-F Ms \ nt. Mak clean
Ii. Use OpenSSL
Use the above function library in VC Configuration:
Choose tools> options. In the displayed dialog box, select the directories tab.
Add the directory "C: \ OpenSSL \ include" in the "show directories for:" "include files" option; "library files" select to add the directory "C: \ OpenSSL \ Lib ".
Then add "libeay32.lib" to compile the project that needs to be linked to the OpenSSL function library.
Iii. Problems
I encountered the following problems when connecting to the static function library of OpenSSL:
Linking...
Msvcrt. Lib (msvcrt. dll): Error lnk2005: _ strchr already defined in libcmtd. Lib (strchr. OBJ)
...
This is because the OpenSSL static function library uses the release version of the multi-threaded DLL of VC, and my program uses the release version of the multi-threaded static link.
You can adjust the library function version used by the static function library of OpenSSL. The adjustment process is as follows:
Edit the file Ms \ nt. Mak and set the file to 19th rows.
"Cflag =/MD/Ox/O2/ob2/W3/wx/gs0/GF/Gy/nologo-dopenssl_sysname_win32-Example-dl_endian-ddso_win32-Example-example/fdout32-Example-example- dopenssl_no_seed-dopenssl_no_rc5-dopenssl_no_mdc2-dopenssl_no_tlsext-dopenssl_no_krb5-dopenssl_no_dynamic_engine"
"/MD" in to "/MT ". Then re-compile and install OpenSSL.
Iv. Appendix: Instructions for Compiling different versions of the C/C ++ Runtime Library in VC
In the vc c/C ++ Runtime Library of different versions of the compilation instructions (http://blog.yesky.com/271/dgkang/1737771.shtml) in a detailed description of the connection to different versions of the library compilation instructions are as follows:
C Runtime Library:
/MD msvcrt. Lib multi-threaded DLL release version
/MDD msvcrtd. Lib multi-threaded DLL debug version
/MT libcmt. Lib multi-threaded static link release version
/MTD libcmtd. Lib multi-threaded static link debug version
/CLR msvcmrt. Lib: a mixture of managed code and unmanaged code
/CLR: Pure msvcurt. Lib pure managed code
C ++ Standard Library:
/MD msvcprt. Lib multi-threaded DLL release version
/MDD msvcprtd. Lib multi-thread DLL debug version
/MT libcpmt. Lib multi-threaded static link release version
/MTD libcpmtd. Lib multi-threaded static link debug version