boost::asio ssl linking error
Asked Answered
D

3

6

I'm using boost version 1.47, visual studio 2010, I downloaded the binaries for windows and linked to the include directory and lib directory from my project preferences. But I still can't use any ssl functionality from boost::asio.

This is the site where I downloaded the binaries: http://www.slproweb.com/products/Win32OpenSSL.html

I Downloaded: Visual C++ 2008 Redistributables and Win32 OpenSSL v1.0.1

These are the error messages I get:

Error   1   error LNK2019: unresolved external symbol _ERR_reason_error_string referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall boost::asio::error::detail::ssl_category::message(int)const " (?message@ssl_category@detail@error@asio@boost@@UBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\OmniTcp\main.obj   OmniTcp

Error   2   error LNK2001: unresolved external symbol _ERR_reason_error_string  C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\OmniTcp\OmniTcp.obj    OmniTcp

Error   3   error LNK2019: unresolved external symbol _CRYPTO_set_id_callback referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init@openssl_init_base@detail@ssl@asio@boost@@QAE@XZ)  C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\OmniTcp\main.obj   OmniTcp

Error   4   error LNK2001: unresolved external symbol _CRYPTO_set_id_callback   C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\OmniTcp\OmniTcp.obj    OmniTcp

Error   5   error LNK2019: unresolved external symbol _CRYPTO_set_locking_callback referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init@openssl_init_base@detail@ssl@asio@boost@@QAE@XZ) C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\OmniTcp\main.obj   OmniTcp

Error   6   error LNK2001: unresolved external symbol _CRYPTO_set_locking_callback  C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\OmniTcp\OmniTcp.obj    OmniTcp

Error   25  error LNK1120: 12 unresolved externals  C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\Debug\OmniTcp.exe  OmniTcp

I get a few more error messages but hey are all similar to eachother.

Deed answered 21/3, 2012 at 12:52 Comment(10)
Which libs are in your dependencies?Revulsion
I link to: C:\Program Files\boost\boost_1_47\lib C:\OpenSSL-Win32\lib\VC C:\OpenSSL-Win32\libDeed
These are the folders, what are the lib files? In 2005 it's under project-->properties-->Linker-->Input-->Additional Dependencies.Revulsion
I thought they searched auto. They do for boost atleast?Deed
Yes, it uses the #pragma commecnt(lib,...). Try maybe defining BOOST_LIB_DIAGNOSTIC in your project and see if it helps you find which libs are not being loaded properly.Revulsion
I'm not sure how I would do thatDeed
Ok, I linked some of the *.lib files from the lib folder and now it's working. Thanks for your help!Deed
I guess some solution is better than no solution but this is probably not the optimal way to do it. I did not find in the boost documentation whether on Windows it is by definition not required to explicitly link with libs of SSL or it is true just for some other specific libraries.Revulsion
@Revulsion make your comment an answerBangtail
I am getting the similar link errors after updrading to openssl 3.0 version.Kerouac
T
6

These are the libraries I linked to with boost 1.69, visual studio 2019, and OpenSSl-Win64:

libssl.lib;libcrypto.lib
Trenttrento answered 5/5, 2019 at 12:24 Comment(0)
S
3

As mentioned in the comments to the question, my project linked once I added:

lib\libeay32.lib
lib\ssleay32.lib

To the Project->Configuration Properties->Linker->Input->Additional Dependencies property.

Supervisor answered 31/10, 2013 at 19:6 Comment(0)
R
2

Add the SSL dependencies (lib files) manually to project-->properties-->Linker-->Input-->Additional Dependencies.

Revulsion answered 22/3, 2012 at 14:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.