更新时间:2021-08-24 22:40:48
-Wno-unused-variable
开关通常可以解决问题.但是,如果您关心项目中的这些事情,这确实是一个非常有用的警告.但是,当 GCC 开始警告您代码中没有的内容时,这会很烦人.
The -Wno-unused-variable
switch usually does the trick. However, that is a very useful warning indeed if you care about these things in your project. It becomes annoying when GCC starts to warn you about things not in your code though.
我建议您保持警告,但使用 -isystem
而不是 -I
来包含第三方项目的目录.该标志告诉 GCC 不要就您无法控制的内容向您发出警告.
I would recommend you keeping the warning on, but use -isystem
instead of -I
for include directories of third-party projects. That flag tells GCC not to warn you about the stuff you have no control over.
例如,使用 -isystem C:\boost_1_52_0
而不是 -IC:\boost_1_52_0
.
For example, instead of -IC:\boost_1_52_0
, say -isystem C:\boost_1_52_0
.
希望有帮助.祝你好运!
Hope it helps. Good Luck!