Cocos2d-x 3.0 编译 eclipse+Win7+Android 篇

文档

Eclipse --> Windows--> Preferences ...

3. Set up Variables: 

1. Path Variable `COCOS2DX`: 
* Eclipse->Preferences->General->Workspace->**Linked Resources**
* Click **New** button to add a Path Variable `COCOS2DX` pointing to the root cocos2d-x directory.
![Example](https://lh5.googleusercontent.com/-oPpk9kg3e5w/UUOYlq8n7aI/AAAAAAAAsdQ/zLA4eghBH9U/s400/cocos2d-x-eclipse-vars.png)


2. C/C++ Environment Variable `NDK_ROOT`: 
* Eclipse->Preferences->C/C++->Build->**Environment**.
* Click **Add** button and add a new variable `NDK_ROOT` pointing to the root NDK directory.
![Example](https://lh3.googleusercontent.com/-AVcY8IAT0_g/UUOYltoRobI/AAAAAAAAsdM/22D2J9u3sig/s400/cocos2d-x-eclipse-ndk.png)
* Only for Windows: Add new variables **CYGWIN** with value `nodosfilewarning` and **SHELLOPTS** with value `igncr`


4. Import libcocos2dx library project:
1. File->New->Project->Android Project From Existing Code.
2. Click **Browse** button and open `cocos2d-x/cocos2dx/platform/android/java` directory.
3. Click **Finish** to add project.

#### Adding and running from Eclipse


![Example](https://lh3.googleusercontent.com/-SLBOu6e3QbE/UUOcOXYaGqI/AAAAAAAAsdo/tYBY2SylOSM/s288/cocos2d-x-eclipse-project-from-code.png) ![Import](https://lh5.googleusercontent.com/-XzC9Pn65USc/UUOcOTAwizI/AAAAAAAAsdk/4b6YM-oim9Y/s400/cocos2d-x-eclipse-import-project.png)


1. File->New->Project->Android Project From Existing Code
2. **Browse** to your project directory. eg: `cocos2d-x/cocos2dx/samples/Cpp/TestCpp/proj.android/`
3. Add the project 
4. Click **Run** or **Debug** to compile C++ followed by Java and to run on connected device or emulator.

Cocos2d-x 3.0 编译 eclipse+Win7+Android 篇,,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。