Please Help! Failed to setup environment on win7 with eclipse!

All the tutorial I found is not for cocos2d-x-3.0 beta 2, really hope there is a tutorial for setting up environment on win7 with eclipse

when using the python script build_native.py to build the project in eclipse, error message like ‘拒绝访问’ is shown, has anyone succesfully build a project in eclipse running on win7?

Could you describe how you did step by step?

Minggo Zhang wrote:

Could you describe how you did step by step?

Hello! I’m using cocos2d-x-3.0beta2 and here is what I did:

  1. create a new C++ project using create_project.py(GUI)
  2. add NDK_ROOT, ANDROID_SDK_ROOT, NDK_TOOLCHAIN_VERSION as C++ build environment variables
  3. import project ‘libcocos2dx’ and the new project into eclipse, and add ‘libcocos2dx’ as library of new project
  4. convert the new project to C++ project by ‘Convert to a C/C++ Project’, but I found CDT Builder is not added into Builders, so I edit .project file manually to add CDT Builder
  5. change the build command in ‘C/C++ Build->Builder Settings’ to python ${ProjDirPath}/build_native.py
  6. uncheck Syntax and Semantic Errors in C/C++ General->Code Analysis(use project settings)
  7. remove ‘Classes’, ‘cocos2dx’, ‘extensions’ and ‘scripting’ link folder
  8. goto ‘C/C++ general->Paths and Symbols->Source Location’ and add link folder ‘Classes’ and ‘cocos2dx’ to the source location
  9. goto ‘C/C++ general->Paths and Symbols->includes’ and add ${NDK_ROOT}/platforms/android-18/arch-arm/usr/include into include directories
  10. click ‘Build Project’

the python script did start running and compile the source code files, but after several cpp
files are compiled, the following error is shown:
make.exe: ***拒绝访问
. Stop
make.exe *** Waiting for unfinished jobs....

in the Traceback I found line 89 is where the exception was raised, so there maybe something wrong in ‘do_build’ function, it cause line 88 ‘os.system(command)’ always failed to execute the command.

I print out the command:
G:/android-ndk-r9c\ndk-build -j4 -C G:\cocos2d-x-3.0beta2\MyGame\proj.android NDK_MODULE_PATH=G:\cocos2d-x-3.0beta2\MyGame\proj.android\../cocos2d;G:\cocos2d-x-3.0beta2\MyGame\proj.android\../cocos2d/external;G:\cocos2d-x-3.0beta2\MyGame\proj.android\../cocos2d/cocos

Please help!!!

If I click ‘Build Project’ after the error happend, the script will start to compile other source code, but after a while the same error will show up…

It seems that the path is error. Because there is a path like G:\cocos2d-x-3.0beta2\MyGame\proj.android../cocos2d exits in NDKMODULEPATH. It should be G:\cocos2d-x-3.0beta2\MyGame\proj.android/../cocos2d

I change the path’s format to ‘code’, the path is right. Just a forum text formating issue.:slight_smile:

I find every time an .a file is created, that error will happen. If I keep compiling until all .a files are created until the final libcoocos2dcpp.so is created, the app will launch.

So, still wondering what’s wrong in build_native.py line 88?
the return value of os.system(command) is 2, means ‘No such file or directory’

I guess there is something tricky about the way python handle slash and back slash of a path. I’m using python 2.7.6 for windows
If I execute build_native.py in cygwin, line 68 is executed, it can’t find toolchains, line 61 os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.8")) return False, the path is /cygdrive/g/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8, the dir does exists, otherwise the script will not compile source files when executing in eclipse.

maybe we should customize build_native.py for each environment:

  1. win7, use “” as path splitter("/" is also acceptable but can’t mixed with “”, just stick to one choice!)
  2. win7 with cygwin, use “/” as path splitter, but path like /cygdrive/g/xyz should be changed by cygpath -w before passed to python function
  3. mac, use “/” as path splitter

You don’t need cygwin now. We offer python script to discard cygwin. So you don’t have to use the python in cygwin style now. Change it to windows path style.

Hi,

After following the install steps using setup.py,
on WIN-7, ndk-9, python 2.7.6. cocos2x-3.0RC2

I have created a NEW -cpp project using the cocos.py
I have CDT plugin installed, but when I select Convert To, it says no builder.
I checked the .project file and it has the cdt builders added.
The Github download is dated 15-apr-2014.

there is no .cproject file in proj.android
Also. under the android-tools menu in eclipse, there is no option similar to “support native xxx”.

By the way, cocos2d-x-2.23 works completely.

any ideas ?