Integrating COCOS2D-X with Eclipse

Integrating COCOS2D-X with Eclipse
0.0 0


Is there a way to be able to code the C++ parts using Eclipse and its context assist? Because the source code is separate from the android folder, I’d have to make a new project. Even if I did that, the headers wouldn’t all resolve because the lib and stuff are compiled in the android folder. In my opinion, it would be easier if you AndroidManifest.xml in the project’s root folder and just create a makefile with android, win32, and ios targets.

Also is there a way to make a Win32 project using Eclipse? I don’t have VisualStudio and don’t want to bother learning it.

Cocos2d-x debugging with Eclipse: issue when trying to debug native code (when connecting with gdbserver)
Using Eclipse Content Assist

ha, I always write codes in Xcode or VisualStudio, then run ndk build in command line, pack in eclipse.
Waiting eclipse masters to answer this question.


I Manually Integrated the Test suite with Eclipse.

Now I can Modify the C/C*+ and Java code from the Eclipse and with single click on Clean/Auto Build, The android apk file is generated by Eclipse.
*I have Eclipse with JEE Installed already.+

To Edit java/C/C+ code at the same Time*
First Installed CDT plugin from Eclipse Update site using Eclipse —> Help —> Install New Software.
# Create the Project using the Cocos2d-x android project template.
# Go to Eclipse —> New Android Project and select create project with existing source.
# Go to Eclipse —> File —> NEW —> Convert to a C/C
+ project.
The project properties has now Java as well as C/C*+ Build options.
# Go to Project —> Properties —>C/C*+ General —>Paths and Symbols.
# Now Add all the Header file Include Directories required by your project under Include Tab.
# Add your project C/C++ Source files/Folder under the “Source Location” Tab and Press Apply and OK.
With this Now I am able to Code java and C/C++ at the same time.
h1.**Building the project i.e Generating Project.apk in Eclipse*

  1. Go to Project —> Properties —> Click on Builders —> Click On New
  2. Select Program and click ok.
  3. Enter any Name or some thing like “NDK Build Configuration” in the Name Tab.
  4. Click on Main tab, Enter the path of your Cygwin bash.exe in the Location box. Ex: C:.exe
  5. Enter the Cygwin Bin folder path in the Working Directory box. Ex: C:# In the Arguments box Enter the command in the below format
    loginc “cd /cygdrive/PATH to YOUR Project Directory && ./”
    Example: —login -c “cd /cygdrive/d/Android/cocos2d/tests/ && ./”
  6. Click on Refresh tab
  7. Select “Specific resources” radio button and click on Specify Resources button and select only the lib’s folder check box under your Android project and click finish.
  8. Select the “Recursively include sub-folders check box.
    # Click on Build Options Tab and Select”Specify working set of relevant resources" check box and click on the Specify Resources button and select the Jni folder check box under your android project and click finish.
  9. Now select all the check boxes except “File” and “During a Clean”
  10. Click on apply or Ok —> Properties Builder

You are Done.


Interesting. And can you debug the c++ stuff sucessfully with this approach?


Do I include cocos2d-x/cocos2dx/include or just the cocos2d-x/cocos2dx folder? cause main.cpp can’t find cocos2d.h. Also, what kind of C/C++ project do I convert it to? Executable, Shared Library, or something else?


Found out another way to do it. It’s similar to yours, RamaKrishna, but I didn’t use a builder. What I did convert it to a C++ project as a makefile project, specifying my own toolset. I made a makefile in the project’s root folder with the following entry:


I had to change’s build variables to use windows path names rather than cygwin path names as seen below:

/cygdrive/c/cygwin/bin -> C:/cygwin/bin

For content assist, and so that eclipse wouldn’t whine about unresolved files, I just linked the header folders as source locations, rather than as includes. Here are the folders that I linked:

for C/C++ assists: C:\android-ndk-r5b\sources\
for created classes: C:\cocos2d-x\myProject\Classes\
for cocos2d assists: C:\cocos2d-x\cocos2d\


Isaac Ashdown @ No, There are some online tutorials on Debugging NDK and Java in Eclipse I am still checking them.

check this Link for more Information:


Aye, RamaKrishna, I followed that tutorial, and others, in the past, but with no luck ;(


NDK & Cocos2d-x debugging.

I am able to debug Native code with Android Java in Eclipse Helios on my Windows 7 laptop.

I used the same settings for the Cocos2d-X tests project and I got error some thing like

For all Breakpoint source files I got “No source file named [source].cpp” [source] respective source filename…

Does anyone have worked successfully with cocos2d-x with NDK debugging in windows.



I’m still having issues with the instructions :(, I wish there is a full tutorial on this one, cause it is really important and I need to edit c++ and build the project using eclipse.
any help would be greatly appreciated


it’s good, thank you.


No worries, it works now :slight_smile:


Happy to see that it works Breaking Floor :slight_smile: Can you, or anybody, write a very detailed step by step procedure/tutorial on this topic ? Would be really great


There is one in


hi, I am having this error. during debugging.
while following the steps from
environment: windows 7 + cygwin

MG_14@MG_14-PC /cygdrive/c/Development/cocos2d-x12/ecli/android
$ /cygdrive/c/Development/android-ndk-r7b/ndk-gdb-eclipse
awk: fatal: can't open source file `/cygdrive/c/Development/cocos2d-x12/ecli/android/C:\Development\android-ndk-r7b/build/awk/check-awk.awk' for reading (No such file or directory)
ERROR: Could not run '/usr/bin/awk' command. Do you have it installed properly?

I visited my C:-ndk-r7b/build/awk/check-awk.awk. The file exists there. which path do I need to edit ?

thanks in advance :slight_smile:



Unfortunately I wasn’t able to make it work on cygwin. Just on Linux.




for future use :

To fix this, set ANDROID_NDK_ROOT to the Cygwin’s INNER PATH:


hi again,
now, I am stuck on step 3!
please help(assuming it to be the last step). console log is

Warning: /c/Development/android-ndk-r7b/platforms/android-14/arch-arm/usr/include: No such file or directory.
Warning: /c/Development/android-ndk-r7b/sources/cxx-stl/gnu-libstdc++/include: No such file or directory.
Warning: /c/Development/android-ndk-r7b/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include: No such file or directory.
(no debugging symbols found)
(no debugging symbols found)
41-gdb-set confirm off
42-gdb-set width 0
43-gdb-set height 0
44-interpreter-exec console echo
45-gdb-show prompt
45^done,value="(gdb) "
46-gdb-set auto-solib-add on
47-gdb-set stop-on-solib-events 0
48-gdb-set stop-on-solib-events 1
49-target-select remote localhost:5554
~"Ignoring packet error, continuing...\n"
warning: unrecognized item "timeout" in "qSupported" response
Ignoring packet error, continuing...
&"warning: unrecognized item \"timeout\" in \"qSupported\" response\n"
~"Ignoring packet error, continuing...\n"
Ignoring packet error, continuing...



I have an error in when build project.

Please help me to fix this bug.

Thank you very much


when i followed the steps of
"To Edit java/C/C*+ code at the same Time and Building the project i.e Generating Project.apk in Eclipse"
that i can compiled the c*+ code. thanks.

But i don’t know how to compiled to apk(because i changed to c++ project according to the steps,and also prompt me have no make target
make: * No rule to make target `all’. Stop.