Eclipse Compiled COCOS2DX 3.0

Source: Internet
Author: User
Tags lua

First to self-science, the Android SDK is for Java developers, we C + + developers using the Android NDK, so is to use the NDK to compile the COCOS2DX program

To create a project using the command line, I create a LUA project here: Cocos new Lua_proj2-p com.company_name.program_name-l lua-d d:\xxx\xxx
At this point, a demo program is created, you can use the Cocos command to generate an APK package, go to the directory lua_proj2\frameworks\runtime-src below, execute commands under this directory Cocos compile-p Android An APK package will be generated, drag this onto the genymotion, and the installation is up and running.
It says that instead of using eclipse to generate an APK package, the following is the process of loading the LUA_PROJ2 project in Eclipse and generating the APK package. Why do I have to import the COCOS2DX project into eclipse to build the APK package, because in eclipse you can connect the AVD to debug the Android program, and then eclipse can run under the Linux environment, and I'm going to develop it on Linux later, So this is a step that must be stepped out.

Open Eclipse, Load Lua_proj2 Project, note here, do not need to load LIBCOCOS2DX this project, just load lua_proj2 this oneself new project can
In Eclipse, right-click Properties lua_proj2. The Properties for Lua_proj2 box appears

Create a new builder

The first red box is the builder name, fill it out, the second red frame is the NDK generation tool, that is, using this tool to compile C + + projects, the third red is the working directory, where I use the LUA_PROJ2 project directory as the working directory, switch to the Environment tab, Create a new environment variable ndk_module_path used in this builder, the value is ... \lua_proj2\frameworks\cocos2d-x\cocos;......\lua_proj2\frameworks\ Cocos2d-x;......\lua_proj2\frameworks\cocos2d-x\external, the front of the ... is the absolute directory omitted, here to enter the absolute path name, here I do not write absolute path.

All the way down to the bottom of this screen

The newly built builder, Project->build Project

A lot of error occurred: ' Override ' does not name a type error, this is because the NDK version is too low, override is c++11 in the keyword, and to NDKr10 support c++11, so to upgrade the NDK. Go to the official website to download it http://developer.android.com/tools/sdk/ndk/index.html#Installing is not big, more than 400 m look, after the update is complete, look at the Ndk\ Toolchains directory below the compiler, my directory is the following I would like to use clang to compile, but at this stage I will not configure, with GCC bar, x86-4.6 & x86-4.8 Two versions of GCC, 4.8 support C + + 11 add a sentence in application.mk ndk_toolchain_version = 4.8 is to specify the use of GCC4.8 to compile the COCOS2DX project, run up,  Here is the console output of eclipse running up with the command line execution Cocos Compile-p Android run out is the same, all in the compiler program. Go below to debug the program under Eclipse

Eclipse Compiled COCOS2DX 3.0

Related Article

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.