雷达智富

首页 > 内容 > 程序笔记 > 正文

程序笔记

C/C++使用gcc或g++编译报错:error: parameter ‘xxx’ set but not used [-Werror=unused-but-set-parameter]

2024-07-17 55

问题描述

使用gcc或g++编译时报:error: parameter ‘xxx’ set but not used [-Werror=unused-but-set-parameter]的错误,原因是有参数申明了,但在后面的代码中并没有使用到这个参数,编译器将这种情况视为错误了。

解决办法

对于报类似的错误,可以增加编译选项-Wno-error=unused-but-set-parameter将错误视为警告,或者-Wno-unused-but-set-parameter完全屏蔽掉这个问题。

更新于:2个月前
赞一波!2

文章评论

全部评论