#include “d:\project\cocos2dx\cocos2d-x-2.2.6\cocos2dx\platform\third_party\win32\curl\curl.h”
unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* pszMode, unsigned long * pSize)
{
unsigned char * pBuffer = NULL;
CCAssert(pszFileName != NULL && pSize != NULL && pszMode != NULL, “Invalid parameters.”);
*pSize = 0;
//CURL *curl = curl_easy_init();
CURL *curl = curl_easy_init();//找不到引用呀
}
工程已经引用了这个
$(ProjectDir)…\cocos2dx\platform\third_party\win32\curl
但是还是报链接不到
CCFileUtils.obj : error LNK2019: 无法解析的外部符号 __imp__curl_easy_init,该符号在函数 “public: virtual unsigned char * __thiscall cocos2d::CCFileUtils::getFileData(char const *,char const *,unsigned long *)” (?getFileData@CCFileUtils@cocos2d@@UAEPAEPBD0PAK@Z) 中被引用
testapp里的CurlTest.cpp却没有问题,但是我直接F5,调试不了curl_easy_init,curl_easy_init直接跑到DLL
// the test code is
// http://curl.haxx.se/mail/lib-2009-12/0071.html
void CurlTest::ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent)
{
CURL *curl;
CURLcode res;
char buffer;
curl = curl_easy_init();
if (curl)
{
curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/Resources2/fileLookup.plist");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
if (res == 0)
{
m_pLabel->setString("0 response");
}
else
{
sprintf(buffer,"code: %i",res);
m_pLabel->setString(buffer);
}
}
else
{
m_pLabel->setString("no curl");
}
}
何解,在CCFileUtils::getFileData里却引用不了curl_easy_init