Configure/compile/Run COCOS2DX project under Ubuntu

Source: Internet
Author: User

For project reasons, it is necessary to put a project using COCOS2DX into Linux (using vs authoring under Windows, which works properly), and debugging at night for about 3 to one hour, finally running the project. Keep a note of the notes here and make it easy for you to remind everyone not to make the same mistake.

I am using Ubuntu kylin 14.04, the COCOS2DX version is 2.2.3.

Project engineering documents are as follows:

Already contains the COCOS2DX package, its own project is in projects.
The contents of the Projects folder are as follows:
The classes folder is the source file for the project, including some. h and source code for. cpp.
The Resources folder is a resource file for the project, including some pictures and text.

What we focus on is the Proj.linux folder, which reads as follows:
Main.cpp is the main function of the project, which includes a call to the upper-level classes file.
The build.sh and makefile files are compiled for the project and are the focus of our attention.

My makefile file is as follows and is for informational purposes only:

executable = Thedemoincludes =-I.. /I.. /.. /I.. /classes-i$(Cocos_root)/cocosdenshion/include-i$(Cocos_root)/extensions/-I.$(Cocos_root)/external/-I.$(Cocos_root)/external/chipmunk/include/chipmunk//Note to include all project files, for me, the contents of the Classes folder mentioned aboveSOURCES = main.cpp. /classes/appdelegate.cpp. /classes/helloworldscene.cpp. /classes/eventmanager.cpp. /classes/gamedata.cpp. /classes/gamescene.cpp. /classes/levelselect.cpp. /classes/mynodes.cpp cocos_root =.. /.. /.. Include$(Cocos_root)/cocos2dx/proj.linux/cocos2dx.mk//Here are some Lib files and library files, is a reference to the COCOS2DX sample project written, is not here to waste a long time. Sharedlibs + =-lcocos2d-lcocosdenshion-lcurl-lpthreadcocos_libs =$(Lib_dir)/libcocos2d.so$(Lib_dir)/libcocosdenshion.sostaticlibs + =$(Lib_dir)/libextension.a$(Lib_dir)/libbox2d.a$(Lib_dir)/libchipmunk.a$(TARGET):$(OBJECTS)$(STATICLIBS)$(COCOS_LIBS)$(Core_makefile_list)@mkdir-P$(@D)$(Log_link)$(CXX)$(Cxxflags)$(OBJECTS)-O[email protected] $(SHAREDLIBS)$(STATICLIBS)$(OBJ_DIR)/%.O:%.Cpp$(Core_makefile_list)@mkdir-P$(@D)$(LOG_CXX)$(CXX)$(Cxxflags)$(Includes)$(Defines)$(VISIBILITY)-C$<-O[email protected]$(OBJ_DIR)/%.O:.. /%.Cpp$(Core_makefile_list)@mkdir-P$(@D)$(LOG_CXX)$(CXX)$(Cxxflags)$(Includes)$(Defines)$(VISIBILITY)-C$<-O[email protected]

In particular, it is important to note that in the process of compiling and linking, if there is no corresponding or missing files. In the case of the project file and the library file, it is most likely that the makefile file is not written to. Does not contain some file directories or is missing lib files. It should be noted if such a situation arises.
If the command-line operation is cumbersome, using the IDE is a good choice, because it is not very understanding of Ubuntu, but also in the course of learning, debugging this project using the NetBeans 8.0.2, feeling is still relatively useful.

Attach a piece that finally runs successfully:

More in-depth understanding of linux~ in the future

Configure/compile/Run COCOS2DX project under Ubuntu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.