If you are using linux, then building cocos2d-x with CodeBlocks is quite easy. You could use cmake generators for creating a CodeBlocks project (cbp) for building your Cocos2d-x game.
You can do this by simply going to your project’s proj.linux directory and type
cmake ../ -G "CodeBlocks - MinGW Makefiles"
Then , open the cbp file created in your proj.linux directory using CodeBlocks, and start coding.
Please note that the project generated by the cmake CodeBlocks generator is configured as a Command only project , which will give you the following error when you are trying to run the Cocos2d-x game.
You must select a host application to "run" a commands-only target...
In order to solve this issue right click on your CodeBlocks project >> Properties >> Build targets >> Type >> Console Application >> Type the correct output file name (located at the bin directory. And you’re all set!
Happy CodeBlocks Cocos2d-x game programming!