-Werror=maybe-unintialized
CXX obj/release/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.o ../Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp: In member function ‘virtual void TestColliderDetector::update(float)’: ../Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp:1062:27: error: ‘maxx’ may be used uninitialized in this function [-Werror=maybe-uninitialized] ../Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp:1062:27: error: ‘miny’ may be used uninitialized in this function [-Werror=maybe-uninitialized] ../Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp:1062:27: error: ‘minx’ may be used uninitialized in this function [-Werror=maybe-uninitialized] cc1plus: all warnings being treated as errors make[1]: *** [obj/release/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.o] Error 1The first error I encountered was the variable has not been initialize. This is due to the compilation flag set to -Werror set in cocos2dx.mk located in <Cocos2dx_root>/cocos2dx/proj.linux. The simplest way to get rid of this error is to initialize those variable to 0.
-Werror=unused-variable
CXX obj/release/Classes/ExtensionsTest/CocoStudioGUITest/UIListViewTest/UIListViewTest.o ../Classes/ExtensionsTest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp: In member function ‘void UIListViewExTest_Vertical::selectedItemEvent(cocos2d::CCObject*, cocos2d::gui::ListViewEventType)’: ../Classes/ExtensionsTest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp:170:25: error: unused variable ‘listViewEx’ [-Werror=unused-variable] ../Classes/ExtensionsTest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp: In member function ‘void UIListViewExTest_Horizontal::selectedItemEvent(cocos2d::CCObject*, cocos2d::gui::ListViewEventType)’: ../Classes/ExtensionsTest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp:346:29: error: unused variable ‘listViewEx’ [-Werror=unused-variable] cc1plus: all warnings being treated as errorsThe second error is there are some variable has been declare but it is not being use. To get rid of this problem, put additional -Wno-unused-variable flag into cocos2dx.mk file as shown below:
CC = gcc CXX = g++ CCFLAGS += -MMD -Wall -Werror -Wno-unused-variable -fPIC CXXFLAGS += -MMD -Wall -Werror -Wno-unused-variable -fPIC ... ...
No comments:
Post a Comment