在成员函数中curl_easy_init()时无法编译?

时间:2014-05-29 17:08:51

标签: c++ curl linker libcurl

我在下面写了这篇文章,它仅适用于主函数中curl_easy_init()之外的createEasyHandle

使用visual studio 2013

如果我在curl_easy_init()尝试creatEasyHandle我无法编译并且我得到未解决的外部错误。

简而言之,一切正常!当我将句柄传递给createEasyHandle时,但是当我在curl_easy_init()内尝试createEasyHandle时,它告诉我我的外部链接错误2001未解决。

BOOL Connect::createEasyHandle(CURL* easyHandle){
BOOL retVal = FALSE;
CURLcode result = curl_easy_setopt(easyHandle, CURLOPT_URL, "http://google.com/");
if (result == CURLE_OK){

    result = curl_easy_perform(easyHandle);

    if (result == CURLE_OK){

        char* plocalIP;
        CURLcode easyRet = curl_easy_getinfo(easyHandle,  CURLINFO_LOCAL_IP, &plocalIP);
        privateIP = plocalIP;

        retVal = TRUE;
    }
}

curl_easy_cleanup(easyHandle);
return retVal;
}

错误

__imp_curl_easy_(all the functions i tried to use)LINKERROR 2001

给出编译错误/ LINK错误2001的代码

BOOL Connect::createEasyHandle(){
    BOOL retVal = FALSE;
    CURL* easyHandle = curl_easy_init();

而不是

BOOL Connect::createEasyHandle(CURL* easyHandle){
    BOOL retVal = FALSE;

0 个答案:

没有答案