I’m writing a program using Vulkan and GLM in C++ on the Visual Studio 2022 IDE.
GLM produces 109 warnings. Each one looks like this:
Warning C26495 Variable 'glm::tvec4<unsigned char,0>::<unnamed-tag>::<unnamed-tag>::t' is uninitialized. Always initialize a member variable (type.6).
I’m not interested in solving these warnings because I don’t want to change glm or other external dependencies. For reasons of clarity, however, I do not want to display these in the list of warnings. All other warnings should be displayed.
>Solution :
If the warning comes from a header, you can maybe do
#pragma warning( push )
#pragma warning( disable : 26495 )
#include "header"
#pragma warning( pop )
This will save (push) the current warning settings, then disable the specific error (26495). After including the header file, it will then reset the warnings back to what they were before (pop) from when they were saved. Effectively, this disabled the warning throughout the header file.
If it’s from a specific line of your code, you can do
#pragma warning( suppress : 26495 )
suppress is a way to disable a warning for only the next line of code.