libcurl for wp8

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”.

	1	IntelliSense: cannot open source file "curl/curl.h"	d:\ProjectName\Classes\AnyClass.cpp	16	1	HelloCppComponent

Thanks in advance.

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 compile and link it ok. are you in release mode ? config it as the debug mode

i compile in debug mode and use VS 2013 and last version of cocos2dx-master from gitHub.
Do you run wp8-xaml project?

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?

Thanks in advance.

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

I’ve tested the version 2.2.2 it works fine

I have done a lot of actions, and one of them gived me possitive result and libcurl worked fine in wp8-xaml project, thanks to all :slight_smile:

Can I use CCHttpClient in wp8 project?

https://github.com/cocos2d/cocos2d-x/pull/5098 has httpclient in it, but I still faced error in it. I contact with martell now and hope it will solved soon.