[SOLVED] cocos2d-x-3.0: fatal error: cocos/network/SocketIO.h: No such file or directory

[SOLVED] cocos2d-x-3.0: fatal error: cocos/network/SocketIO.h: No such file or directory
0.0 0


Hi, there,

My NDK 9.0,
Andriod SDK 19,
Linux build ok, but when run the fellow script in terminal, it goes wrong. How to edit the Andirod.mk file? Thanks for help.

$ python build_native.py
jni/../../Classes/HelloWorldScene.cpp:6:36: **fatal error: cocos/network/SocketIO.h: No such file or directory**
 #include "cocos/network/SocketIO.h"
compilation terminated.
make: *** [obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o] Error 1
Traceback (most recent call last):
  File "/home/mic/work/hello_project/app/proj.android/build_native.py", line 168, in <module>
  File "/home/mic/work/hello_project/app/proj.android/build_native.py", line 155, in build
    do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
  File "/home/mic/work/hello_project/app/proj.android/build_native.py", line 91, in do_build
    raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")
Exception: Build dynamic library for project [ /home/mic/work/hello_project/app/proj.android ] fails!


Have you added these lines to Android.mk ?

LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static
$(call import-module,network)


My version of the build scripts expects this EXACT file stucture:


Does this file exist in this exact location?–


Ok, I have tried to include this file in my own project and saw the same error.

I was able to fix it by adding the following to jni/Android.mk:

however, I think it’s not intended that this be necessary. I think the authors want it to be implied by passing it as NDK_MODULE_PATH to ndk-build, but it’s not working.


Hi, good news! It is so kind of you that when I modify the file /home/mic/work/ohello_project/proj.android/jni/Android.mk as you have described up, it was passed compiling!
I research the whole day on last weekend in this error, and now, becouse of you, everything is okay, thank you!
(i am a Newbie in cocos2d-x and Andriod… I will write a wiki for configure development evironment in Ubuntu14.04 by KDevelop4.6)


I have to add LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../cocos2d in /home/mic/work/ohello_project/proj.android/jni/Android.mk for compiling passed, too.
Then I find that it was diffirent from #include "network/SocketIO.h" to #include "cocos/network/SocketIO.h", because build_native.py doesn’t provide the path for hello_project/${COCOS2D_ROOT} which the latter method can auto be included of. So, thank you, now it was run on my andriod device! :slight_smile: