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
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 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:
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>
// wp8 support winsock2, winrt not support
#include <WinSock2.h>
#undef timeval
struct timeval
	long tv_sec;		// seconds
	long tv_usec;    // microSeconds

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?

#9 has httpclient in it, but I still faced error in it. I contact with martell now and hope it will solved soon.