我在下面写了这篇文章,它仅适用于主函数中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;