robintw
robintw

Reputation: 28601

Warning C4341 - 'XX': signed value is out of range for enum constant

When compiling my C++ .Net application I get 104 warnings of the type:

Warning C4341 - 'XX': signed value is out of range for enum constant

Where XX can be

I can't seem to remove these warnings whatever I do. When I double click on them it takes me to a part of my code that uses OdbcParameters - any when I try a test project with all the rest of my stuff but no OdbcParameters it doesn't give the warnings.

Any idea how I can get rid of these warnings? They're making real warnings from code I've actually written hard to see - and it just gives me a horrible feeling knowing my app has 104 warnings!

Upvotes: 6

Views: 1262

Answers (3)

Mat Noguchi
Mat Noguchi

Reputation: 1080

Either wait for a compiler fix or dont #include code that triggers it.

[A verbose way of saying you probably can't.]

Upvotes: 0

Aidan Ryan
Aidan Ryan

Reputation: 11607

This is a compiler bug. Here's another post confirming it's a known issue. I've got the same issue in one of my projects and there's no way to prevent it from being triggered unless you have some way of avoiding the use of OdbcParameter. The most conservative way to suppress only the buggy warnings is to use

#pragma warning( push )
#pragma warning( disable: 4341 )

// code affected by bug

#pragma warning( pop )

Upvotes: 4

Huppie
Huppie

Reputation: 11432

In Visual Studio you can always disable specific warnings by going to:

Project settings -> C/C++ -> Advanced -> Disable Specific warnings: 4341

Upvotes: 3

Related Questions