Why remove network from cocos-ext.h, it’s a bug or something else?
#include “network/HttpRequest.h”
#include “network/HttpResponse.h”
#include “network/HttpClient.h”
#include “network/WebSocket.h”
#include “network/SocketIO.h”
The network part is one of the main cores in cocos2d-x, it’s no longer a extension part.
So we change the path to make it more clearly.
How are we supposed to now use the network classes?
At the moment, in iOS/Mac projects I have no issues but it appears to be unlocatable in Android and win32 projects.
In Visual Studio I can access functions like this:
network::HttpRequest *request = new network::HttpRequest();
if I include the header like this:
@#include "HttpClient.h"
otherwise, the network classes are invisible.
However, I still get errors making it unusable:
@Error 350 error LNK2019: unresolved external symbol "public: static class cocos2d::network::HttpClient * __cdecl cocos2d::network::HttpClient::getInstance(void)" (?getInstance
HttpClient@network@cocos2d@SAPAV123
XZ)
Android is equally unusable, saying HttpClient.h is an unrecognised file or directory however I try to use it.
I could compile network modules by adding these lines to Android.mk in my project.
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static
$(call import-module,network)
@do-low
I found you should also add
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
$(LOCAL_PATH)/../../cocos2d/cocos/network
As gonjay said, it is necessary to include network sources.
@gonjay
Thanks for further information I’ve missed!