Developers Manual > Cocos2d-x > Deprecated Docs for Cocos2d-x > Setting up Development Environments > Linux Environment Setup > How to run HelloWorld and tests on linux

How to run HelloWorld and tests on linux

cocos2d-x supports linux platform from cocos2d-1.0.1-x-0.9.2.
This document will describe how to run HelloWorld and tests on linux and android simulator.

The enviroment is ubuntu 11.04 + eclipse3.7.

1. Set up environment

1.1 get cocos2d-x source code

a) get latest code from git, it is not stable

git clone

b) get released version, it is stable

1.2. install android sdk, use eclipse as IDE

Refer the link to install android sdk
Use this appoach to install jdk

sudo add-apt-repository "deb lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk

1.3. install cdt for eclipse to compile c/c*+ codes in eclipse

Help -> Install New Software…-> Add…

The link of cdt is
h3. 1.4. install needed libs
sudo apt-get install libgl1-mesa-dev libglfw-dev freeglut3-dev libzip-dev
If you meet problem as me, maybe you should run the command before installing the libs
sudo apt-get -f
h2. 2. Run with makefile
First, build all libraries


COCOS2DX is the root of the cocos2d-x.
It is simple to run with makefile

cd \$HELLOWORLD/linux/

HELLOWORLD is the root of helloworld, in my environment it is /home/zhangxm/cocos2d-x/HelloWorld.
You can run tests in the same way. It is simple, isn’t it?
h2. 3. Run with eclipse
First, import existing projects: File-> Import…

Then select the directory of the root of cocos2d-x

Now, you can build and run HelloWorld and tests.

  • build
    Right click the project of HelloWorld -> Build Project
  • run
    Right click the project of HelloWorld-> Run as -> Local c/c*+ Application

You can run tests in the same way.

4. Run on android emulator

Please refer How to build and run HelloWorld.

install_cdt.jpg (46.8 kB) zhangxm, 2011-09-20 22:46

import_project.jpg (32.3 kB) zhangxm, 2011-09-20 22:59

select_project.jpg (75.8 kB) zhangxm, 2011-09-22 22:41

Copyright © 2010 - 2013 Cocos2d-x.orgClustrmaps