鏈接一個程序時,我知道這是編程問題,但我只是感到沮喪試圖找出我在做什麼錯..尚未解決的符號使用的libcurl
我使用Visual Studio 2010和遵循所有的步驟這裏:http://curl.haxx.se/libcurl/c/visual_studio.pdf
當我嘗試編譯我的解決方案我不斷收到此錯誤:
1>------ Build started: Project: LibCurl, Configuration: Debug Win32 ------
1>LibCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_cleanup referenced in function _main
1>LibCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_perform referenced in function _main
1>LibCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_setopt referenced in function _main
1>LibCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_init referenced in function _main
1>C:\Users\Kyle\Documents\Visual Studio 2010\libcurl\VisualStudio\LibCurl\Debug\LibCurl.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
來源:
// LibCurl.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#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://google.com");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
請確保您已執行鏈接pdf中的步驟4.3.2和4.3.3。你會得到一個鏈接器錯誤,這意味着它沒有鏈接到文件'libcurl.lib'。 – 2010-11-14 08:43:48
謝謝傑西。我會更慢地重做這些步驟,看看它爲什麼沒有被鏈接。謝謝您的幫助! – Kyle 2010-11-14 09:02:48