Search code examples
eclipseadtcocos2d-x

How to convert cocos2d-x android project to c++ in eclipse ADT


Hi I'm fairly new with Eclipse. I'm trying to work on my cocos2d-x project on Eclipse, but for some reason I couldn't convert the android project to a c/c++ project and so I couldn't open the c++ files inside the Classes folders as you can see on the image here.

  • cocos2d-x: cocos2d-x v3.0 alpha0
  • eclipse: (ADT)Android Developer Tools - Build: v22.2.1-833290
  • os: windows 7

What I did:

  1. ran create-multi-platform-projects.py in cmd
  2. opened eclipse(ADT) then File->New->Other->Android Project from Existing Code->browsed to {cocos2d-x v3}/projects/mygame/proj.android
  3. built the project.
  4. tried to convert the project. Right-clicked project->New->Other->Under C/C++ tree, select Convert to a C/C++ project (Adds C/C++ nature)

but then the candidates for conversion is empty, meaning I couldn't convert my project to c++. I have installed the C++ plugins as seen here. Obviously I'm missing something here but I can't figure out what. I've been following tutorials on setting up cocos2d-x android development on eclipse windows os but I'm stuck with the converting to c++ step. Please could someone point out what I'm missing. Thanks in advance.


Solution

  • It will already be having c++ nature, so it wont show you that option (You can verify this by checking if you have C/C++ build in your project properties)...

    You can open the cpp files by adding a reference to the source folder, to do so follow the below steps:

    1. Right Click your project and select properties
    2. Goto Resource->Linked Resources
    3. In Path Variables Tab, Click New...
    4. Give some name and choose the folder where you have your source code

    It will now show a link to the source code folder in the project