[cocos2d-x]编译cocos2d-win32.vc2010报错

1.下载 cocos2d-x-2.1.4 版本,解压到工作盘,目录最好不要太深,后面可能会从命令行进入。

2.双击 cocos2d-win32.vc2010.sln,而不是 build-win32.bat.

3.右击解决方案,生成解决方案。生成完后,发现有两个错误:

错误 84 error MSB3073: 命令“if not exist "E:/libraries/cocos2d-x-2.1.4/Debug.win32/" mkdir "E:/libraries/cocos2d-x-2.1.4/Debug.win32/"
if exist "E:/libraries/cocos2d-x-2.1.4/Debug.win32//CocosDragonJSRes" rd /s /q "E:/libraries/cocos2d-x-2.1.4/Debug.win32//CocosDragonJSRes"
mkdir "E:/libraries/cocos2d-x-2.1.4/Debug.win32//CocosDragonJSRes"
xcopy "E:/libraries/cocos2d-x-2.1.4/samples/Javascript/CocosDragonJS/proj.win32/../../../../scripting/javascript/bindings/js/*.js" "E:/libraries/cocos2d-x-2.1.4/Debug.win32//CocosDragonJSRes" /e /Y
xcopy "E:/libraries/cocos2d-x-2.1.4/samples/Javascript/CocosDragonJS/proj.win32/../../Shared/games/CocosDragonJS/Published files Android" "E:/libraries/cocos2d-x-2.1.4/Debug.win32//CocosDragonJSRes/" /e /Y
:VCEnd”已退出,代码为 4。 C:/Program Files/MSBuild/Microsoft.Cpp/v4.0/Microsoft.CppCommon.targets 103 6 CocosDragonJS

错误 108 error MSB3073: 命令“if not exist "E:/libraries/cocos2d-x-2.1.4/Debug.win32/" mkdir "E:/libraries/cocos2d-x-2.1.4/Debug.win32/"
if exist "E:/libraries/cocos2d-x-2.1.4/Debug.win32//WatermelonWithMeRes" rd /s /q "E:/libraries/cocos2d-x-2.1.4/Debug.win32//WatermelonWithMeRes"
mkdir "E:/libraries/cocos2d-x-2.1.4/Debug.win32//WatermelonWithMeRes"
xcopy "E:/libraries/cocos2d-x-2.1.4/samples/Javascript/WatermelonWithMe/proj.win32/../../../../scripting/javascript/bindings/js/*.js" "E:/libraries/cocos2d-x-2.1.4/Debug.win32//WatermelonWithMeRes" /e /Y
xcopy "E:/libraries/cocos2d-x-2.1.4/samples/Javascript/WatermelonWithMe/proj.win32/../../Shared/games/WatermelonWithMe" "E:/libraries/cocos2d-x-2.1.4/Debug.win32//WatermelonWithMeRes/" /e /Y
:VCEnd”已退出,代码为 4。 C:/Program Files/MSBuild/Microsoft.Cpp/v4.0/Microsoft.CppCommon.targets 103 6 WatermelonWithMe

4.上面我已经用蓝色标出了几个目录,这就是错误所在,发现这几个目录并不存在。(说明 cocos2d-x 发布版本的时候也不太细心啊~)

5.进入目录 samples/Javascript/Shared/games ,新建两个目录 CocosDragonJS 和 WatermelonWithMe ,然后在 CocosDragonJS 下新建 Published files Android 目录,再次编译,就已经成功了。

6.不要再对使用vs模板来创建项目想入非非了,虽然有 install-templates-msvc.bat ,其实根本没用的,(不知官方怎么想的)。

7.现在创建项目要安装 Python 2.7.3 了!安装好后,在系统变量后加入安装目录,比如:C:/Python27。

8.从命令行进入 cocos2d-x-2.1.4/tools/project-creator,执行 create_project.py -project 项目名 -package 包名 -language cpp ,这里注意下包名一定要是 com.lyout.game 这样,三个节点,两个节点会报错!,生成的项目在库根目录下的 projects 目录正面查看。

9.当然为了让大家省事,我依然创建了一个批处理文件:create-project.bat,放在 cocos2d-x 目录下,内容如下:

@echo offcd tools/project-creatorset /p projectName=请输入项目名称:if "%projectName%"=="" goto lblExitcreate_project.py -project %projectName% -package com.lyout.game -language cpppauseexit:lblExit@echo 项目名称不能为空!pause

以后,双击这个文件,输入项目名就可以在 projects 目录下面生成各平台的项目了!

你可能感兴趣的:([cocos2d-x]编译cocos2d-win32.vc2010报错)