移植cocos2d-x 到ubuntu 12.04

      怎么移植网上很多教材,按部就班就OK,但在make过程中,出现了一个源码级问题:

../Classes/PerformanceTest/PerformanceAllocTest.cpp: 在成员函数‘virtual void NodeCreateTest::initWithQuantityOfNodes(unsigned int)’中:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:256:49: 警告: 格式 ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘unsigned int’ [-Wformat]
../Classes/PerformanceTest/PerformanceAllocTest.cpp: 在成员函数‘virtual void NodeDeallocTest::initWithQuantityOfNodes(unsigned int)’中:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:308:49: 警告: 格式 ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘unsigned int’ [-Wformat]
../Classes/PerformanceTest/PerformanceAllocTest.cpp: 在成员函数‘virtual void SpriteCreateEmptyTest::initWithQuantityOfNodes(unsigned int)’中:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:365:51: 警告: 格式 ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘unsigned int’ [-Wformat]
../Classes/PerformanceTest/PerformanceAllocTest.cpp: 在成员函数‘virtual void SpriteCreateTest::initWithQuantityOfNodes(unsigned int)’中:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:419:51: 警告: 格式 ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘unsigned int’ [-Wformat]
../Classes/PerformanceTest/PerformanceAllocTest.cpp: 在成员函数‘virtual void SpriteDeallocTest::initWithQuantityOfNodes(unsigned int)’中:
../Classes/PerformanceTest/PerformanceAllocTest.cpp:473:51: 警告: 格式 ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘unsigned int’ [-Wformat]


注意:由于我问题已经解决,没有保留bug现场,原问题是以上显示的'警告'是'错误',然后无法继续make,即输出make error

官方解决方案在此,如果官方解决方案仍无法解决问题,执行我的解决方案:

~/document/cocos2d-x-2.2.1/cocos2dx/proj.linux# cp cocos2dx.mk cocos2dx.mk.backup && vim cocos2dx.mk

注意:红色路径是源码中的具体目录,要修改的文件是去死去死团的cocos2dx.mk配置文件(修改前先备份),修改内容为:

 
CC = gcc
CXX = g++
CCFLAGS += -MMD -Wall -Werror -fPIC
CXXFLAGS += -MMD -Wall -Werror -fPIC

删除 -Werror ! 
更改后为:

CC = gcc
CXX = g++
CCFLAGS += -MMD -Wall -fPIC
CXXFLAGS += -MMD -Wall -fPIC


具体原因是,由于编译工具不同,在gcc/g++4.6以上的版本对弱格式转换提出警告,而-Werror的指令含义是将警告作为错误处理,warning变error,在我们不想降低gcc工具的版本时(想降低的都是爱将就的死人),可以去掉-Werror的选项。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值