Www.cnblogs.comSadNightp3364994.html cocos2d-x version updated quickly, the tutorial materials can not keep up with, recently need to use cocos2d-x to find a lot of information to get, I wrote it here to share it with the people who need it. This tutorial does not provide detailed steps but will provide reference articles. If I write a brief article, you can read the original reference.
Http://www.cnblogs.com/SadNight/p/3364994.html cocos2d-x version updates fast, the tutorial materials can not keep up with, recently need to use cocos2d-x to find a lot of information to get, I wrote it here to share it with the people who need it. This tutorial does not provide detailed steps but will provide reference articles. If I write a brief article, you can read the original reference.
Http://www.cnblogs.com/SadNight/p/3364994.html
Cocos2d-x version updates fast, the tutorial materials can not keep up with, recently need to use cocos2d-x to find a lot of information to get, written here to share with the need of people
The detailed steps are not provided in this tutorial, but a reference document is provided. If I write a brief article, you can refer to the original document for reference, note that you only need to read the corresponding part when reading the original text.
If you encounter errors during the compilation process, please check the following summary of errors in the article. If not, please let me know.
This tutorial needs to be downloaded:
1. vs2010 Simplified Chinese: http://download.microsoft.com/download/1/4/3/143B7583-6225-474F-88D5-5811FBC470FD/X16-57473VS2010ProTrialCHS.iso
2. java jdk 1.6: http://www.java.net/download/jdk6/6u10/promoted/b32/binaries/jdk-6u10-rc2-bin-b32-windows-i586-p-12_sep_2008.exe
3. android sdk: http://developer.android.com/sdk/index.html (please refer to the download notes android sdk)
4. eclipse 4.3.1: http://www.eclipse.org/downloads/
5. adt 22.2.1: https://dl.google.com/android/ADT-22.2.1.zip
6. ndk r9: http://developer.android.com/tools/sdk/ndk/index.html
7. cdt 8.2.1: http://www.eclipse.org/cdt/downloads.php.
8. cocos2d-x 2.2.0: http://www.cocoachina.com/bbs/read.php? Tid = 154886 (see download notes cocos2d-x)
9. cocos2d-x 2.1.3: https://cocos2d-x.googlecode.com/files/cocos2d-2.1rc0-x-2.1.3.zip
10. cygwin: http://baoku.360.cn/soft/show/appid/102350562 (please refer to the download notes cygwin)
11. python 2.7.3: http://www.python.org/getit/releases/2.7.3/
Download notes:
1. android sdk
After SDK Manager is installed, it is slow or cannot be downloaded. (We recommend that you use this method to download the SDk first)
Http://blog.csdn.net/android_tutor/article/details/7425021 ()
(1) Open the C: \ Windows \ System32 \ drivers \ etc \ hosts file
(2) Add a line of 74.125.237.1 dl-ssl.google.com at the end
2. cocos2d-x
Here I downloaded the cocos2d-x provided by CocosStudio, after the cocos2d-x2.0 version has CocosStudio integration, you can download that
The latest official version seems to be written with vs2012 no cocos2d-win32.vc2010.sln
3. cygwin
I have downloaded the official website but cannot read the download URL during installation, so I use this
Installation notes:
1. Do not include Chinese characters or spaces in the installation path. Please change all the paths to only English numbers and underscores (_).
2. Download the android sdk. You only need to download the android sdk 2.2 and 2.3.
3. Build Windows 7 + vs2010
Http://blog.csdn.net/ccf19881030/article/details/9204801 ()
(1) install vs2010 on your own
(2) extract the cocos2d-x 2.2.0 to the directory you want to put
(3) run this file under cocos2d-x 2.2.0, then you can compile and run something
(4) install the cocos2d-x vs Project template, which is a way to create a project (if you don't need the cocos2d-x vs Project template, you don't need this step)
① Decompress cocos2d-x 2.1.3
Copy the folder under cocos2d-x 2.1.3 \ template to cocos2d-x 2.2.0 \ template
Copy the file under the cocos2d-x 2.1.3 directory to the cocos2d-x 2.2.0
④ Run
Note:
Go to vs10 solution> Add new project to see if there is any red area
If you do not have one, use a text tool to open it and add a pause (for example) at the end to run
If you see
Enter regedit in the running process to enter the registry, and change the default value under [HKEY_CLASSES_ROOT \. js] To "JSFile ".
TIPS:
I. Set the project created through this method as the startup Item. Right-click the project and set it as the startup Item.
II. The content in the red box below is a column. If you do not read it, you can right-click the project and remove it (it will not be deleted, but it will not appear here or compiled, if needed, you can add an existing project)
The blue box shows the support files for js and lua scripts. You can unmount them if you don't need them, but right-click the project I recommend and uninstall the project.
III Right-click solution Configuration Manager to manage the projects you want to generate. You only need to compile the columns and libraries you want to view, and then you can cancel their generation, compile your project only
(5) install Python (this is an officially recommended method for creating a new project)
① Install Python on your own
Configure python.exe in the path C: \ Python27 to the system path environment variable.
③ Create a project
I D: // switch the drive letter because my Cocos2d-x source code is on disk D, create_project.py is under this directory.
Ⅱ cd D: \ cocos2dx_2.2.0 \ tools \ project-creator // enter the directory where the create_project.py script is located
Iii. Run the script to generate the HelloWorld project. The command is python create_project.py-project HelloWorld-package com.cocos2dx.org-language cpp.
HelloWorld is the project name, And com.cocos2dx.org is the package Identification name for android.
Then, in the D: \ cocos2dx_2.2.0 \ projects path, you can find the project directory you just created, as shown in figure
Classes is the cocos2dx code folder. Resources is the resource folder. proj. win32 is a win32 project. Click here to run your project.
(6) Note
When adding a new class in vs10, do not add the class in red with the blue one, and then select the path to the Classes folder.
4. eclipse does not need to be installed and decompressed to the desired path.
5. Install the cdt and adt plug-ins of eclipse
Http://www.cnblogs.com/ybgame/archive/2012/06/07/2540693.html ()
(1) Click red
(2) Click Add in
Enter ADT or CDT in the Name field
Click Archive to find the adt and cdt plug-in you downloaded and then click OK.
Select all content and wait for him to finish. then agree to the terms. Next, wait for him to restart.
6. Install cygwin
Http://www.cnblogs.com/lhming/archive/2012/06/27/2566460.html ()
When cygwin is installed, I will not write the original article for details. Note that only part of "2. Cygwin installation" will be read.
Note that:
I only found these autoconf2.1, automake1.10, binutils, gcc-core, gdb, pcre, pcre-devel, gawk, make
These few don't find gcc-, g ++, gcc4-core, gcc4-g ++ (if you find it, please let me know, I thank you here first)
Then gcc-, g ++ does not know if the original author is wrong. I only found a gcc-g ++
Then configure D: \ cygwin \ bin to the system path environment variable.
7. Decompress ndk r9 to the directory you want
8. Import the cocos2d-x project in eclipse
(1) Import D: \ cocos2dx_2.2.0 \ cocos2dx \ platform \ android \ java project in eclipse
(2) Import D: \ cocos2dx_2.2.0 \ projects \ HelloWorld \ proj. android project in eclipse (a project created using Python)
(3) Window, preferences, c/c ++, Build, Environment add, such as NDK_ROOT
Http://blog.163.com/sylar_lin/blog/static/192332093201312232155220/()
9. Add the. cpp file you use in this place. If only the. h file is available, write the. h file.
10. This should be done. If you still cannot run it, please let me know and I will keep updating it,
11. Please note that there are generally error reports in your console output