Ошибка при линковке статической библиотеки
Есть 2 файла заголовочный(Api.h) и Api.cpp Код Api.h
size_t writeData(char* ptr, size_t size, size_t nmemb, std::string* data);
std::string Sendrequest(std::string url, std::string params);
Код Api.cpp
size_t writeData(char* ptr, size_t size, size_t nmemb, std::string* data)
{
if (data) {
data->append(ptr, size * nmemb);
return size * nmemb;
}
else
return 0;
}
std::string Sendrequest(std::string url, std::string params)
{
CURL* ch = curl_easy_init();
std::string responseString;
if (ch != NULL)
{
curl_easy_setopt(ch, CURLOPT_URL, url.c_str());
curl_easy_setopt(ch, CURLOPT_POST, true);
curl_easy_setopt(ch, CURLOPT_POSTFIELDS, params.c_str());
curl_easy_setopt(ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, writeData);
curl_easy_setopt(ch, CURLOPT_WRITEDATA, &responseString);
CURLcode result = curl_easy_perform(ch);
if (result != CURLE_OK)
{
curl_easy_cleanup(ch);
return curl_easy_strerror(result);
}
curl_easy_cleanup(ch);
return responseString;
}
}
Api.h подключается к основному файлу, и если в таком виде попытаться собрать, то линковщик ругается на неразрешенный символ, если же код из Api.cpp перенести в основной файл, то все линкуется и собирается, что я делаю не так? Ошибки:
1>Api.obj : error LNK2001: неразрешенный внешний символ __imp_curl_easy_perform.
1>Api.obj : error LNK2001: неразрешенный внешний символ __imp_curl_easy_init.
1>Api.obj : error LNK2001: неразрешенный внешний символ __imp_curl_easy_cleanup.
1>Api.obj : error LNK2001: неразрешенный внешний символ __imp_curl_easy_setopt.