microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
8.01k stars 1.66k forks source link

websocket build error #1422

Open Yang09701194 opened 4 years ago

Yang09701194 commented 4 years ago

I'm build a project written in last year by others, and got following error with websocket, in this source code file: https://github.com/pcman-bbs/pcman-windows/blob/master/Lite/Websocket.cpp

The error messages:

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol _CONF_modules_unload referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init@openssl_init_base@detail@ssl@asio@boost@@QAE@XZ)   Lite    MyDir\Lite\Websocket.obj    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)    Lite    MyDir\Lite\Websocket.obj    1   
Error   LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall web::websockets::client::details::websocket_client_task_impl::websocket_client_task_impl(class web::websockets::client::websocket_client_config)" (__imp_??0websocket_client_task_impl@details@client@websockets@web@@QAE@Vwebsocket_client_config@234@@Z) referenced in function "public: __thiscall std::_Ref_count_obj<class web::websockets::client::details::websocket_client_task_impl>::_Ref_count_obj<class web::websockets::client::details::websocket_client_task_impl><class web::websockets::client::websocket_client_config>(class web::websockets::client::websocket_client_config &&)" (??$?0Vwebsocket_client_config@client@websockets@web@@@?$_Ref_count_obj@Vwebsocket_client_task_impl@details@client@websockets@web@@@std@@QAE@$$QAVwebsocket_client_config@client@websockets@web@@@Z) Lite    MyDir\Lite\Websocket.obj    1   
Error   LNK2019 unresolved external symbol "__declspec(dllimport) public: class Concurrency::task<class web::websockets::client::websocket_incoming_message> __thiscall web::websockets::client::details::websocket_client_task_impl::receive(void)" (__imp_?receive@websocket_client_task_impl@details@client@websockets@web@@QAE?AV?$task@Vwebsocket_incoming_message@client@websockets@web@@@Concurrency@@XZ) referenced in function "public: class Concurrency::task<class web::websockets::client::websocket_incoming_message> __thiscall web::websockets::client::websocket_client::receive(void)" (?receive@websocket_client@client@websockets@web@@QAE?AV?$task@Vwebsocket_incoming_message@client@websockets@web@@@Concurrency@@XZ)    Lite    MyDir\Lite\Websocket.obj    1   
Error   LNK2019 unresolved external symbol "__declspec(dllimport) public: void __thiscall web::websockets::client::details::websocket_client_task_impl::close_pending_tasks_with_error(class web::websockets::client::websocket_exception const &)" (__imp_?close_pending_tasks_with_error@websocket_client_task_impl@details@client@websockets@web@@QAEXABVwebsocket_exception@345@@Z) referenced in function __catch$??R<lambda_6faaa49c60b61750ef16c4ff707b1ae7>@@QBE@V?$task@X@Concurrency@@@Z$0    Lite    MyDir\Lite\Websocket.obj    1   

Seems complicated, how to solve these errors?

Yang09701194 commented 4 years ago

I'm new to C++, and after Hard internet searching, I got it this kind of error message is about C++ class declare deifnition, have declare but not define it. I'm doing some more explore and try.

gh-interests2 commented 4 years ago

I have seen two other very recent references to pretty much this exact problem. One, here: https://antichat.com/threads/476858/ and another, here: http://www.cplusplus.com/search.do?q=websocket_client_task_impl (now, seemingly deleted).

The fact that four of us have had the same problem in the last month and that it did not exist previously seems very strange and makes me wonder if there is not some problem with the latest version package source code.

Yang09701194 commented 4 years ago

These days in another repo we find that, if we want to install cpprestsdk through vcpkg, the original command vcpkg install cpprestsdk is not work now, this command doesn't install boost and websocketpp, also not auto build with CMake,

now need to use command vcpkg install cpprestsdk[default-features,websockets]:x86-windows to auto get all the packages need and aoto build, also auto prase by visual studio when include in .cpp.

Some related info:

dotkt commented 4 years ago

These days in another repo we find that, if we want to install cpprestsdk through vcpkg, the original command vcpkg install cpprestsdk is not work now, this command doesn't install boost and websocketpp, also not auto build with CMake,

now need to use command vcpkg install cpprestsdk[default-features,websockets]:x86-windows to auto get all the packages need and aoto build, also auto prase by visual studio when include in .cpp.

Some related info:

* [microsoft/vcpkg#10478](https://github.com/microsoft/vcpkg/pull/10478)

* [microsoft/vcpkg@056e951](https://github.com/microsoft/vcpkg/commit/056e9517ec7c461cdfabe8ff73124325708a4723)

thanks ,you save my time.