Step by step instructions for cocos2d-x-3.0beta2 and Eclipse

Most of the instructions are found in this thread with the exception of adding build command:
http://www.cocos2d-x.org/forums/6/topics/44319?r=44530#message-44530

  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. Under buildSpec, add

<buildCommand>
  <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
  <triggers>clean,full,incremental,</triggers>
  <arguments>
  </arguments>
</buildCommand>
  1. uncheck ‘use default build command’ and change the build command in ‘C/C++ Build->Builder Settings’ to
C:/your-python-installation-dir/python ${ProjDirPath}/build_native.py
  1. uncheck Syntax and Semantic Errors in C/C++ General->Code Analysis(use project settings)

  2. remove ‘Classes’, ‘cocos2dx’, ‘extensions’ and ‘scripting’ link folder

  3. goto ‘C/C++ general->Paths and Symbols->Source Location’ and add link folder ‘Classes’ and ‘cocos2dx’ to the source location

  4. goto ‘C/C++ general->Paths and Symbols->includes’ and add ${NDK_ROOT}/platforms/android-18/arch-arm/usr/include into include directories

  5. click ‘Build Project’

Tested on Windows XP

Manually adding the CDT builder was exactly what I needed. After the “Convert to C++ project” step, the CDT builder was missing. The text formatter chewed up the XML in the original post, here’s what it looks like:

                &lt;buildCommand&gt;
                        &lt;name&gt;org.eclipse.cdt.managedbuilder.core.genmakebuilder&lt;/name&gt;
                        &lt;triggers&gt;clean,full,incremental,&lt;/triggers&gt;
                        &lt;arguments&gt;
                        &lt;/arguments&gt;
                &lt;/buildCommand&gt;

I was also able to simply use

${ProjDirPath}/build_native.py

since I’m on a Mac.

Tested on Mac OSX Mavericks, Eclipse Indigo, CDT 8.0.2