首页 > 代码库 > Cocos2d-x 3.0 编译 eclipse+Win7+Android 篇
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.
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。