C++ no 'object' file generated

Quaid Tseng picture Quaid Tseng · Jan 17, 2014 · Viewed 15.7k times · Source

This is some code to get an environment variable from inside Qt, however, it seems Qt's QProcessEnvironment::systemEnvironment() only reflect a new environment variable change after reboot. So I am thinking about using getenv. However I got "error C2220: warning treated as error - no 'object' file generated" from this :

QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
const QString ENGINE_ROOT = env.value("ENGINE_ROOT", "") != "" ? 
env.value("ENGINE_ROOT","") : QString(getenv("ENGINE_ROOT"));

Don't tell me something like disable /WX or lower W4 to W3, I don't want to hear this, I want to know exactly what cause

no 'object' file generated

.

Answer

jalf picture jalf · Jan 17, 2014

"error C2220: warning treated as error - no 'object' file generated"

The error already answers your question:

  1. A warning was generated.
  2. Because you have told the compiler to treat warnings as errors, an error occurred.
  3. Because an error occurred, the compiler did not generate an object file.

If you want to know what the original warning means, then you need to ask us about that warning.