Calling REST api from C++

Hello All,

I want to call REST api from C++ code. I am trying to use casablanca library, However while compiling and linking, I am getting following linking error

1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) long __cdecl pplx::details::platform::GetCurrentThreadId(void)" (__imp_?GetCurrentThreadId@platform@details@pplx@@YAJXZ) referenced in function "public: void __thiscall pplx::details::_CancellationTokenState::_DeregisterCallback(class pplx::details::_CancellationTokenRegistration *)" (?_DeregisterCallback@_CancellationTokenState@details@pplx@@QAEXPAV_CancellationTokenRegistration@23@@Z)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) unsigned int __cdecl pplx::details::platform::CaptureCallstack(void * *,unsigned int,unsigned int)" (__imp_?CaptureCallstack@platform@details@pplx@@YAIPAPAXII@Z) referenced in function "public: static class pplx::details::_TaskCreationCallstack __cdecl pplx::details::_TaskCreationCallstack::_CaptureMultiFramesCallstack(unsigned int)" (?_CaptureMultiFramesCallstack@_TaskCreationCallstack@details@pplx@@SA?AV123@I@Z)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall pplx::details::event_impl::event_impl(void)" (__imp_??0event_impl@details@pplx@@QAE@XZ) referenced in function "public: __thiscall pplx::details::_TaskCollectionImpl::_TaskCollectionImpl(struct pplx::scheduler_ptr)" (??0_TaskCollectionImpl@details@pplx@@QAE@Uscheduler_ptr@2@@Z)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall pplx::details::event_impl::~event_impl(void)" (__imp_??1event_impl@details@pplx@@QAE@XZ) referenced in function "public: __thiscall pplx::details::_TaskCollectionImpl::~_TaskCollectionImpl(void)" (??1_TaskCollectionImpl@details@pplx@@QAE@XZ)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall pplx::details::event_impl::set(void)" (__imp_?set@event_impl@details@pplx@@QAEXXZ) referenced in function "public: void __thiscall pplx::details::_CancellationTokenState::_Cancel(void)" (?_Cancel@_CancellationTokenState@details@pplx@@QAEXXZ)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall pplx::details::event_impl::wait(unsigned int)" (__imp_?wait@event_impl@details@pplx@@QAEII@Z) referenced in function "public: void __thiscall pplx::details::_CancellationTokenState::_DeregisterCallback(class pplx::details::_CancellationTokenRegistration *)" (?_DeregisterCallback@_CancellationTokenState@details@pplx@@QAEXPAV_CancellationTokenRegistration@23@@Z)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall pplx::details::critical_section_impl::critical_section_impl(void)" (__imp_??0critical_section_impl@details@pplx@@QAE@XZ) referenced in function "public: __thiscall pplx::details::_Task_completion_event_impl<unsigned char>::_Task_completion_event_impl<unsigned char>(void)" (??0?$_Task_completion_event_impl@E@details@pplx@@QAE@XZ)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall pplx::details::critical_section_impl::~critical_section_impl(void)" (__imp_??1critical_section_impl@details@pplx@@QAE@XZ) referenced in function __unwindfunclet$??0_Task_impl_base@details@pplx@@QAE@PAV_CancellationTokenState@12@Uscheduler_ptr@2@@Z$2
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall pplx::details::critical_section_impl::lock(void)" (__imp_?lock@critical_section_impl@details@pplx@@QAEXXZ) referenced in function "public: __thiscall pplx::scoped_lock<class pplx::details::critical_section_impl>::scoped_lock<class pplx::details::critical_section_impl>(class pplx::details::critical_section_impl &)" (??0?$scoped_lock@Vcritical_section_impl@details@pplx@@@pplx@@QAE@AAVcritical_section_impl@details@1@@Z)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall pplx::details::critical_section_impl::unlock(void)" (__imp_?unlock@critical_section_impl@details@pplx@@QAEXXZ) referenced in function "public: __thiscall pplx::scoped_lock<class pplx::details::critical_section_impl>::~scoped_lock<class pplx::details::critical_section_impl>(void)" (??1?$scoped_lock@Vcritical_section_impl@details@pplx@@@pplx@@QAE@XZ)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class std::shared_ptr<struct pplx::scheduler_interface> __cdecl pplx::get_ambient_scheduler(void)" (__imp_?get_ambient_scheduler@pplx@@YA?AV?$shared_ptr@Uscheduler_interface@pplx@@@std@@XZ) referenced in function "public: __thiscall pplx::task_options::task_options(void)" (??0task_options@pplx@@QAE@XZ)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall web::http::details::http_msg_base::extract_utf8string(bool)" (__imp_?extract_utf8string@http_msg_base@details@http@web@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall <lambda_356af9349449439b600f7e9c8f85b774>::operator()(unsigned __int64)const " (??R<lambda_356af9349449439b600f7e9c8f85b774>@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_K@Z)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __thiscall web::http::details::http_msg_base::extract_utf16string(bool)" (__imp_?extract_utf16string@http_msg_base@details@http@web@@QAE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@_N@Z) referenced in function "public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __thiscall <lambda_64db3a834f26f8f0ae7665534f1ace48>::operator()(unsigned __int64)const " (??R<lambda_64db3a834f26f8f0ae7665534f1ace48>@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@_K@Z)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __thiscall web::http::details::http_msg_base::extract_string(bool)" (__imp_?extract_string@http_msg_base@details@http@web@@QAE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@_N@Z) referenced in function "public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __thiscall <lambda_17292223c85917ddca22883278822d6c>::operator()(unsigned __int64)const " (??R<lambda_17292223c85917ddca22883278822d6c>@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@_K@Z)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class web::json::value __thiscall web::http::details::http_msg_base::_extract_json(bool)" (__imp_?_extract_json@http_msg_base@details@http@web@@QAE?AVvalue@json@4@_N@Z) referenced in function "public: class web::json::value __thiscall <lambda_4ff94744ead14514ff9bd2660a200813>::operator()(unsigned __int64)const " (??R<lambda_4ff94744ead14514ff9bd2660a200813>@@QBE?AVvalue@json@web@@_K@Z)
1>MFCApplication1Dlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::vector<unsigned char,class std::allocator<unsigned char> > __thiscall web::http::details::http_msg_base::_extract_vector(void)" (__imp_?_extract_vector@http_msg_base@details@http@web@@QAE?AV?$vector@EV?$allocator@E@std@@@std@@XZ) referenced in function "public: class std::vector<unsigned char,class std::allocator<unsigned char> > __thiscall <lambda_62072eb4ba9ac8ce4ad7117ed1dcde41>::operator()(unsigned __int64)const " (??R<lambda_62072eb4ba9ac8ce4ad7117ed1dcde41>@@QBE?AV?$vector@EV?$allocator@E@std@@@std@@_K@Z)
1>E:\Work\RESTclient1\MFCApplication1\Debug\MFCApplication1.exe : fatal error LNK1120: 16 unresolved externals


Kindly guide me how to get rid from these linking error, or is there any other way to call REST api from C++ code?
Thanks in advance, Looking forward to your help.

Best regards,
-Vijay
You either link against the wrong library or not at all.
Topic archived. No new replies allowed.