technically you should create muti project for muti platform , and each project share the same c++ code , but only the code wrote with cocos2dx's api .
and you have to wrote different code for different platform to start the game , which I call it Entry code.
but cocos2dx provides some tools , such as create_project.py , to help you to do with these mess , so we can only concentrated on games it self.
but we still have to compile on each platform .