error: variable ‘XXXX’ set but not used [-Werror=unused-but-set-variable]

error: variable ‘XXXX’ set but not used [-Werror=unused-but-set-variable]

编译的时候出现这个错误

error: variable ‘XXXX’ set but not used [-Werror=unused-but-set-variable]

2、解决办法
找到相应的Makefile文件

LOCAL_CFLAGS += -Wall -Werror

去掉上面的 -Werror,改成如下

LOCAL_CFLAGS += -Wall

或CMake(CMakeLists)
error: variable ‘XXXX’ set but not used [-Werror=unused-but-set-variable]_第1张图片
也就是把 -Werror 去掉即可!

你可能感兴趣的:(Bug,cmake,c++,linux,bug)