In the previous tutorial, we demonstrated how to useVs2010 creates a new project and teaches you how to solve header file inclusion errors and Lib Library Reference errors step by step.AndDLL Link error. However, every time you build a project is so time-consuming, it is not very uncomfortable, and each project has to copy a cocos2d-x, cocoadension and box2d folder, and configure Lib, DLL, too time-consuming, this is a waste of space!
So, is there any way not to be so troublesome? Of course. The purpose of this tutorial is to teach you how to create a new project more easily. There are two main methods:
Method 1: (official practice)
- Open the cocos2d-1.0.1-x-0.9.1 file under the F: \ cocos2d-win32.vc2010.sln directory, right-click solution, and choose add-new project, such:
Next, select the cocos2d-x from the installed template, select the cocos2d-x Win32 application, and finally give the new project a name named "helloworldbox2d" below, as shown below :( note the default position F: \ cocos2d-1.0.1-x-0.9.1 cannot be changed !!!)
After the project is created, right-click helloworldbox2d, set it to start the project, and then press "Ctrl + F5! Simple, the following shows the running effect:
Method 2:
On the basis of the previous tutorial, instead of opening the F: \ cocos2d-1.0.1-x-0.9.1 \ cocos2d-win32.vc2010.sln file, you create a new project. Then, we are not copying folders, Lib, and DLL. We only need to copy all the release DLL versions to the C: \ windows \ system32 directory. (Because the cocos2d-x generated the debug version of The Link Library and the release version of The Link Library name is the same, so you just need to copy the release on the line, I tried, it is also feasible to link the release dynamic link library in debug mode .)
Next, let's do something else.
- First create a folder cocos2d-xSources in disk D, then copy box2d, cocos2dx, cocosdenshion to this directory, and then create a new folder libs, the specific directory structure such:
Then put f: \ cocos2d-1.0.1-x-0.9.1 \ release. Win32 Directory
Libcocos2d. Lib
Libegl. Lib
Libgles_cm.lib
Libcocosdenshion. Lib
Iconv. Lib
Libxml2.lib
Zlib1. lib
Copy all to the newly created libs directory.
- Next, we need to set the VC header file including the Directory and Library Reference Directory: Select "Property Manager" and then select debug | Win32, as shown in:
Double-click the Microsoft. cpp. win32.user file and select the VC ++ directory, as shown in the following figure:
Next, we will change the "include directory" and "library directory" on the right, and click in the blank area on the right,
Select "edit", and add all the directories shown in. Then, OK:
Then, "Ctrl + F5", haha, success! Both debug and release can be compiled and run successfully. However, the EXE file generated by debug may be considered as a virus by 360... Speechless! Then, try again to focus on creating a new project. Haha, it can be compiled and run successfully, and a lot of unnecessary settings are missing. The disadvantage of this method is that the CPP implementation cannot be viewed. However, I think this method is more lightweight. Although method 1 is good and easy to set up, after you write a lot of projects, you will find loading very slow, especially for people with poor configuration. For method 2, if the cocos2d-x is upgraded, that is, rebuild the lib and DLL and overwrite the previous one. Copy the three folders box2d, cocos2dx, and cocosdenshion, and overwrite them!
Leave a message? Please click portal!
Copyright statement: This article by Zilong Shan People (http://www.cnblogs.com/andyque) original, welcome to repost share. Please respect the work of the author. Keep this note and the author's blog link when reprinting. Thank you!