Cocos2d-x in Ubuntu 16.04

April 11, 2020

So i was trying to install and setup the cocos2d game engine in Ubuntu 16.04 so I can get started on a c++ project.

I followed the documentation

Everything was fine untill i tried to compile  and run the cpp-tests. So I made a little search and found that before run I should make some library fixes:


First I had to remove libglfw2

sudo apt-get remove libglfw2

Then move manualy fmod (while you are inside cocos folder)

sudo cp external/linux-specific/fmod/prebuilt/64-bit/ /usr/local/lib/
sudo cp external/linux-specific/fmod/prebuilt/64-bit/ /usr/local/lib/

...and create symbolic link in /usr/local/lib/

ln -s

After that I had to reinstall dependecies in folder /build





Creating your first project

You follow the documentation

In case you are going c++ to compile in linux you follow these steps:

From the terminal check cocos version

cocos -v

Create a hello world project

cocos new my_game -p com.MyCompany.my_game -l cpp -d MyCompany

Compile it

cocos compile -s ~/MyCompany -p linux -m release -o ~/MyCompany/my_game/bin

Then run it



Tip: If you create new files in Classes folder should update set(GAME_SRC and set(GAME_HEADERS in CMakeLists.txt file