Compiler Error C2220


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at Compiler Error C2220.

warning treated as error - no object file generated

/WX tells the compiler to treat all warnings as errors. Because an error occurred, no object or executable file was generated.

This error only appears when the /WX flag is set and a warning occurs during compilation. To fix this error, you must eliminate every warning in your project.

To fix, use one of the following techniques

  • Fix the problems that cause warnings in your project.

  • Compile at a lower warning level—for example, use /W3 instead of /W4.

  • Use a warning pragma to disable or suppress a specific warning.

  • Don't use /WX to compile.