3
votes

I am new to Openssl, and trying to run a dhclient program available online at http://www.josuegomes.com/codeblog/dhclient.htm.

While doing so I get following errors,

dhclient.cpp
1>dhclient.obj : error LNK2019: unresolved external symbol _ERR_print_errors_fp referenced in function "void __cdecl handle_error(char const *,int,char const *)" (?handle_error@@YAXPBDH0@Z)
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_load_error_strings referenced in function "void __cdecl init_OpenSSL(void)" (?init_OpenSSL@@YAXXZ)
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_library_init referenced in function "void __cdecl init_OpenSSL(void)" (?init_OpenSSL@@YAXXZ)
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_CTX_set_cipher_list referenced in function "struct ssl_ctx_st * __cdecl setup_ctx(void)" (?setup_ctx@@YAPAUssl_ctx_st@@XZ)
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_CTX_new referenced in function "struct ssl_ctx_st * __cdecl setup_ctx(void)" (?setup_ctx@@YAPAUssl_ctx_st@@XZ)
1>dhclient.obj : error LNK2019: unresolved external symbol _TLSv1_client_method referenced in function "struct ssl_ctx_st * __cdecl setup_ctx(void)" (?setup_ctx@@YAPAUssl_ctx_st@@XZ)
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_CTX_free referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_free referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_shutdown referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_read referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_write referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_connect referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_set_bio referenced in function _main
1>dhclient.obj : error LNK2019: unresolved external symbol _SSL_new referenced in function _main 1>dhclient.obj : error LNK2019: unresolved external symbol _BIO_ctrl referenced in function _main 1>dhclient.obj : error LNK2019: unresolved external symbol _BIO_new_connect referenced in function _main 1>C:\Users\Rucha\Documents\Visual Studio 2010\Projects\emptyprojectssl\Debug\emptyprojectssl.exe : fatal error LNK1120: 16 unresolved externals

I have added includes and library paths, also my runtime library is MD and I have added ssleay32MD.lib libeay32MD.lib to external dependencies.

Please help.

2
Did you ever figure this out? When compiling the OpenSSL libraries I had to make sure that they compiled with the right Visual Studio SDK and the right Platform. Then ensuring they are in the Linker->Input->Additional Dependencies.CaptainBli

2 Answers

2
votes

I had a similar issue and i solved. Try to look if you are using the right libraries, i mean if you are using x64 lib and compiling with 32-bit then it will through the same error. Happy Coding

0
votes

I think the debug libs are ssleay32MDd.lib and libeay32MDd.lib (note the "d" suffix).