Legion
Legion

Reputation: 3447

How do you disable a specific warning for C++ in Visual Studio 2019?

I've found answers which suggest right clicking the solution and going to Code Analysis Settings but this has been deprecated in VS2019. I found a response here on StackOverflow that talked about Roslyn Analyzers, but that only applies to .NET. I need to disable warning C26451 as it's completely useless and underlines every line where an arithmetic operation is performed on an int.

How do I disable this warning and can it be disabled permanently or just per solution?

Upvotes: 4

Views: 7357

Answers (1)

Ron
Ron

Reputation: 15521

To disable a specific warning for a C++ project, choose Project - Properties - Configuration Properties - C/C++ - Advanced - Disable Specific Warnings - Edit... and then input warning code(s) you want to suppress (26451 in your case) without the C part. Disabling warnings

Performing code analysis now does not yield a C26451 warning. That being said, suppressing warnings is best avoided.

Upvotes: 6

Related Questions