[英]Linking curl library problems eclipse
我在日食時嘗試使用curl。 但是我對於Eclipse開發c ++非常陌生。 在鏈接庫時,我遇到以下問題。 與此有關的任何幫助都非常感謝。
我的示例代碼是:
#include <iostream>
#include <string>
#include <curl/curl.h>
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
int main(void)
{
CURL *curl;
CURLcode res;
std::string readBuffer;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://www.google.com");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
std::cout << readBuffer << std::endl;
}
return 0;
}
錯誤是:
12:37:29 **** Incremental Build of configuration Debug for project Bestapi ****
make all
Building target: Bestapi
Invoking: GCC C++ Linker
g++ -L/usr/include -o "Bestapi" ./bestapi.o -l/usr/include
/usr/bin/ld: cannot find -l/usr/include
collect2: error: ld returned 1 exit status
makefile:44: recipe for target 'Bestapi' failed
make: *** [Bestapi] Error 1
12:37:30 Build Finished (took 366ms)
我已經嘗試了許多互聯網上可用的解決方案。 但是我不知道我在哪里做錯了。 一些解決方案是:
我知道這是我無法解決的鏈接問題。 非常感謝任何幫助,因為我對這個開發環境還很陌生
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.