Hello. I know, that curl was ported to wp8 and it is available on cocos2d-x master branch on GitHub. But I can’t find sample of curl usage in test project for wp8-xaml project. I tried to add libcurl project to wp8-xaml solution and add reference on it in HelloCPPComponent project. However when I include “curl/curl.h” in any file of HelloCPPComponent project there was no available paths to “curl/curl.h”.
In HelloCppComponent project Properties, in Additional include directories I add next line $(ProjectDir)..\..\..\..\..\cocos2dx\platform\third_party\wp8\libcurl;
Then curl/curl.h was available for me. But Many others errors had apeared in solution:
I had ever add it to the native testcpp project, it works well, if you want to add it to xaml project, setting the environtment like native testcpp project did.
The link https://github.com/cocos2d/cocos2d-x/pull/5098 created by martell is more complete, it supported openssl, but compiled error. Martell update it at this moment. We will check it and merged soon. Thanks.
chenjc, Thanks for answer. I’ve compiled simple wp8 project (not wp8-xaml) and tried to add “curl/curl.h”, but file “curlbuild.h” doesn’t find the next headers:
<sys/socket.h>
<inttypes.h>
What could be the reason of problem?
P.S: If I manage to compile this project without errors, which conficurations should I edit in wp8-Xaml project from wp8 project for correct work of curl?
after you add libcurl, you need edit cocos2dx\platform\winrt\CCStdC.h as follows
#define _WINSOCKAPI_
// Structure timeval has define in winsock.h, include windows.h for it.
#include <Windows.h>
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
// wp8 support winsock2, winrt not support
#include <WinSock2.h>
#else
#undef timeval
struct timeval
{
long tv_sec; // seconds
long tv_usec; // microSeconds
};
#endif