Cocos2d-x Novice Learning HelloWorld (third) [version number: cocos2d-x-3.1.1]

Source: Internet
Author: User

In the previous section, the sample in the NDK can be executed normally. However, the project generated by Cocos2d-x cannot be compiled successfully. Previous stamp here: http://blog.csdn.net/xjjjjjjjjjjj/article/details/29382201

1. Create a new project

Open cmd and enter the command:

Cocos New Helloworld-p com.hello-l cpp-d E:\WorkSpace\cocos2d-x\l2\
Other platforms Create project stamps here: Http://cocos2d-x.org/wiki/How_to_Start_A_New_Cocos2D-X_Game

Start creating a new project:

After creation, the prompt is successful:

The Project Files folder is as follows:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvegpqampqampqampq/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">



2. Import Androidproject into eclipse

After the import, will be error, missing package,:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvegpqampqampqampq/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">

You need to copy the Android platform package from the Cocos2d-x download package to copy the location for example: (My location is: D:\Program files\cocos2d-x-3.1.1\cocos\platform\android\java\ Src

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvegpqampqampqampq/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">

After copying, it will not be an error, for example:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvegpqampqampqampq/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">


3. Compiling

Select the Helloword project and click menu Project->clean to compile only the selected items.

Compiling takes time, and so on.--------here to spit, C + + is really far worse than Java (using angle)

An error occurred while executing the project. No variables found

The second time repeatedly, too lazy to delete the variable after.


Selected items, right-click Properties

Add three variables to C++build,

Cocos2dx,ndk_root,ndk_module_path (requires COCOS2DX root folder and Android Platform folder).

At this point, the project can be executed in the real machine.


4.helloword code logic is very easy, with programming experience to look at the clear.

C + + base stamp here:

Cocos2d-x mobile game Development Essential C + + language Foundation



Cocos2d-x Novice Learning HelloWorld (third) [version number: cocos2d-x-3.1.1]

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.