我的windows崩溃了,各种烦,没办法,到linux下来搞cocos2d开发吧
首先下载了个cocos2d的源码2.2.1
用#表示cocos2d目录吧
然后unzip#.zip
在#目录下运行./make-all-linux-project.sh
于是生成#/lib/debug/..a ..so
但是
../Classes/PerformanceTest/PerformanceAllocTest.cpp:In member function ‘virtual voidNodeCreateTest::initWithQuantityOfNodes(unsigned int)’:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:256:49:error: format ‘%lu’ expects argument of type ‘long unsignedint’, but argument 2 has type ‘unsigned int’ [-Werror=format]
../Classes/PerformanceTest/PerformanceAllocTest.cpp:In member function ‘virtual voidNodeDeallocTest::initWithQuantityOfNodes(unsigned int)’:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:308:49:error: format ‘%lu’ expects argument of type ‘long unsignedint’, but argument 2 has type ‘unsigned int’ [-Werror=format]
../Classes/PerformanceTest/PerformanceAllocTest.cpp:In member function ‘virtual voidSpriteCreateEmptyTest::initWithQuantityOfNodes(unsigned int)’:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:365:51:error: format ‘%lu’ expects argument of type ‘long unsignedint’, but argument 2 has type ‘unsigned int’ [-Werror=format]
../Classes/PerformanceTest/PerformanceAllocTest.cpp:In member function ‘virtual voidSpriteCreateTest::initWithQuantityOfNodes(unsigned int)’:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:419:51:error: format ‘%lu’ expects argument of type ‘long unsignedint’, but argument 2 has type ‘unsigned int’ [-Werror=format]
../Classes/PerformanceTest/PerformanceAllocTest.cpp:In member function ‘virtual voidSpriteDeallocTest::initWithQuantityOfNodes(unsigned int)’:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:473:51:error: format ‘%lu’ expects argument of type ‘long unsignedint’, but argument 2 has type ‘unsigned int’ [-Werror=format]
有个这个错误,所以编译就停止了
所以
#lib/release/... 好像没有生成
后来我在#目录下运行Makefile文件
生成了lib/release/...a..so
但是也是上面的错误
../Classes/PerformanceTest/PerformanceAllocTest.cpp:In member function ‘virtual voidNodeCreateTest::initWithQuantityOfNodes(unsigned int)’:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:256:49:error: format ‘%lu’ expects argument of type ‘long unsignedint’, but argument 2 has type ‘unsigned int’ [-Werror=format]
../Classes/PerformanceTest/PerformanceAllocTest.cpp:In member function ‘virtual voidNodeDeallocTest::initWithQuantityOfNodes(unsigned int)’:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:308:49:error: format ‘%lu’ expects argument of type ‘long unsignedint’, but argument 2 has type ‘unsigned int’ [-Werror=format]
../Classes/PerformanceTest/PerformanceAllocTest.cpp:In member function ‘virtual voidSpriteCreateEmptyTest::initWithQuantityOfNodes(unsigned int)’:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:365:51:error: format ‘%lu’ expects argument of type ‘long unsignedint’, but argument 2 has type ‘unsigned int’ [-Werror=format]
../Classes/PerformanceTest/PerformanceAllocTest.cpp:In member function ‘virtual voidSpriteCreateTest::initWithQuantityOfNodes(unsigned int)’:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:419:51:error: format ‘%lu’ expects argument of type ‘long unsignedint’, but argument 2 has type ‘unsigned int’ [-Werror=format]
../Classes/PerformanceTest/PerformanceAllocTest.cpp:In member function ‘virtual voidSpriteDeallocTest::initWithQuantityOfNodes(unsigned int)’:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:473:51:error: format ‘%lu’ expects argument of type ‘long unsignedint’, but argument 2 has type ‘unsigned int’ [-Werror=format]
总之都是这个字符串format问题
error: format ‘%lu’ expectsargument of type ‘long unsigned int’, but argument 2 has type‘unsigned int’ [-Werror=format]
在Makefile里面的那一行改呢,我不清楚
下面看看能不能用python建立一个HelloWorld项目,看看能不能运行,因为之前的debugrelease下的链接文件都是生成了的,
只有在Sample/Cpp/...这个目录下的没有完全生成,可能就是一个编译选项的问题(我没有必要怀疑源代码吧?),
但是我没有找到哪里改。。。先不管。。。
用python创建项目
python#/tools/project-creator/create_project.py
这里我忘了怎么敲了
但是
提示非常给力
Usage: create_project.py -projectPROJECT_NAME -package PACKAGE_NAME -language PROGRAMING_LANGUAGE
Options:
-project PROJECT_NAME Project name, for example: MyGame
-package PACKAGE_NAME Package name, for example: com.MyCompany.MyAwesomeGame
-language PROGRAMING_LANGUAGE Major programing lanauge you want to used, should be [cpp | lua |javascript]
Sample 1: ./create_project.py -projectMyGame -package com.MyCompany.AwesomeGame
Sample 2: ./create_project.py -projectMyGame -package com.MyCompany.AwesomeGame -language javascript
./create_project.py -project HelloWorld-package com.boss.helloworld
-language cpp
然后cd到#/projects/HelloWorld/proj.linux
make 一下
cd #/projects/HelloWorld/proj.linux/bin
敲下./HelloWorld
运行成功
虽然有点小问题但是成功了一半了,上面一个问题留给以后解决!