我启用-Wall
并-Wextra
查看了我的项目中的所有警告,但我也在使用一个“库”(我将库的源代码复制/粘贴到libs
我的项目的文件夹中),它会弹出很多警告。该代码附带一本书(OpenGL Super Bible 5),我正在使用它来学习OpenGL。但是我不想看到这段代码生成的所有警告,只看到我src
文件夹中的警告。
有没有办法隐藏来自特定文件夹的警告?
我不会试图隐藏我的警告,我只是想删除作者的警告,以便我可以专注于修复自己的警告。
警告是
./libs/src/GLTools.cpp:123:6: warning: unused parameter ‘szArgv’ [-Wunused-parameter]
In file included from ./libs/src/GLBatch.cpp:36:0:
./libs/include/GLBatch.h: In constructor ‘GLBatch::GLBatch()’:
./libs/include/GLBatch.h:123:16: warning: ‘GLBatch::nNumTextureUnits’ will be initialized after [-Wreorder]
./libs/include/GLBatch.h:122:16: warning: ‘GLuint GLBatch::nNumVerts’ [-Wreorder]
./libs/src/GLBatch.cpp:55:1: warning: when initialized here [-Wreorder]
In file included from ./libs/src/GLBatch.cpp:36:0:
./libs/include/GLBatch.h:131:17: warning: ‘GLBatch::pTexCoords’ will be initialized after [-Wreorder]
./libs/include/GLBatch.h:115:11: warning: ‘GLuint GLBatch::uiVertexArray’ [-Wreorder]
./libs/src/GLBatch.cpp:55:1: warning: when initialized here [-Wreorder]
In file included from ./libs/src/GLBatch.cpp:36:0:
./libs/include/GLBatch.h:125:14: warning: ‘GLBatch::bBatchDone’ will be initialized after [-Wreorder]
./libs/include/GLBatch.h:121:16: warning: ‘GLuint GLBatch::nVertsBuilding’ [-Wreorder]
./libs/src/GLBatch.cpp:55:1: warning: when initialized here [-Wreorder]
In file included from ./libs/src/GLBatch.cpp:36:0:
./libs/include/GLBatch.h:121:16: warning: ‘GLBatch::nVertsBuilding’ will be initialized after [-Wreorder]
./libs/include/GLBatch.h:118:12: warning: ‘GLuint* GLBatch::uiTextureCoordArray’ [-Wreorder]
./libs/src/GLBatch.cpp:55:1: warning: when initialized here [-Wreorder]
./libs/src/GLShaderManager.cpp:481:8: warning: unused parameter ‘szVertexProg’ [-Wunused-parameter]
./libs/src/GLShaderManager.cpp:481:8: warning: unused parameter ‘szFragProg’ [-Wunused-parameter]
恐怕如果我禁用那些特定的警告(-Wunused-parameter
和-Wreorder
),它们可能会发生在我自己的代码中,在这种情况下我会被告知。我是 C++ 的初学者,所以我想得到编译器可以给我的所有帮助来识别我的错误,或者我可能会做的事情是不好的做法。