我使用Qtcreator未解決的符號鏈接在Qt中使用libcurl的程序
當我嘗試編譯我的解決方案我不斷收到這個錯誤(這是從我的Qtcreator)時:
main.obj:-1: error: LNK2019: unresolved external symbol __imp__curl_easy_strerror referenced in function _main
main.obj:-1: error: LNK2019: unresolved external symbol __imp__curl_easy_strerror referenced in function _main
main.obj:-1: error: LNK2019: unresolved external symbol __imp__curl_easy_perform referenced in function _main
main.obj:-1: error: LNK2019: unresolved external symbol __imp__curl_easy_perform referenced in function _main
main.obj:-1: error: LNK2019: unresolved external symbol __imp__curl_easy_perform referenced in function _main
debug\test.exe:-1: error: LNK1120: 5 unresolved externals
來源(這是從他們的curl頁http://curl.haxx.se/libcurl/c/example.html一個sample.c文件):
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* example.com is redirected, so we tell libcurl to follow redirection */
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
我將此添加到我的.pro文件
INCLUDEPATH = C:\Users\Uporabnik\Desktop\curl-7.38.0\curl-7.38.0\include
您可能缺少.pro文件中的LIBS + ='。請將您的.pro添加到問題中,以及libcurl的路徑和失敗的編譯命令。 – hyde 2014-09-25 15:35:05
它沒有幫助 – Seba 2014-09-25 15:42:59
什麼沒有幫助? – hyde 2014-09-25 15:44:00