太難了,報了一堆錯~
1>HttpClient.obj : error LNK2019: unresolved external symbol __imp__curl_global_init referenced in function 「public: __thiscall CHttpClient::CHttpClient(void)」 (??0CHttpClient@@QAE@XZ)
1>HttpClient.obj : error LNK2019: unresolved external symbol __imp__curl_easy_init referenced in function 「public: __thiscall CHttpClient::CHttpClient(void)」 (??0CHttpClient@@QAE@XZ)
1>HttpClient.obj : error LNK2019: unresolved external symbol __imp__curl_easy_setopt referenced in function 「public: int __thiscall CHttpClient::Get(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > &)」 (?Get@CHttpClient@@QAEHABV?char_traits@D@std@@V?KaTeX parse error: Expected group after '_' at position 92: …xternal symbol _̲_imp__curl_easy…basic_string@DU?allocator@D@2@@std@@AAV23@@Z)
1>HttpClient.obj : error LNK2019: unresolved external symbol __imp__curl_easy_cleanup referenced in function 「public: __thiscall CHttpClient::~CHttpClient(void)」 (??1CHttpClient@@QAE@XZ)
如圖所示:
解決方案:
在properties->C/C+±>preprocessor->preprocessor Definitions處加上以下欄位:
BUILDING_LIBCURL;HTTP_ONLY
如圖所示:
別忘了加上curl的鏈接庫~
大家呼叫curl的時候一定要小心噢~