简体   繁体   中英

Suppressing Compiler Warning C++

I'm getting a compile-time error. It complains that I'm initializing a variable, but not referencing it. What's happening is that I initialize it then make a debug print statement that only get's compiled in for a debug build but not a release build. The error in question is warning c4189 (it's treated as an error and won't compile).

Is it possible to suppress this warning? How about warnings in general?

Don't suppress the warning, fix it! Wrap the declaration and initialization of the variable so it only exists in a debug build too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM