title: Attempt to extract a component of a value that is not a structure. c++
body: <p>Off the back of <a href="https://stackoverflow.com/questions/22012562/is-there-anything-wrong-with-this-if-statement-c/22012920">this question</a> I went and did my first debug (n00b) and got the error: <code>Attempt to extract a component of a value that is not a structure.</code> <br>
  What does this mean and what are the implications for my code?</p>
  
  <pre><code>if (questinfo.targetitem == "coins" &amp;&amp; questinfo.targetitemquant &gt;= coins)
  {
      cout &lt;&lt; "You have enough coins to complete your task!" &lt;&lt; endl;
      questactive = false;
  }
  </code></pre>
  
  <p>The struct definition, as requested, is as follows:</p>
  
  <pre><code>struct questdata{
    int ID;
    string targetitem;
    int targetitemquant;
    string questgiver;
    string questdesc;
  };
  questdata questinfo;
  </code></pre>
  
  <p>and the members' values are assigned from an array like so:</p>
  
  <pre><code>questinfo.ID  = atoi(queststuff[0].c_str());
  questinfo.targetitem  = queststuff[1];
  questinfo.targetitemquant  = atoi(queststuff[2].c_str());
  questinfo.questgiver  = queststuff[3];
  questinfo.questdesc = queststuff[4];
  </code></pre>
  
  <p>I thought it could be that <code>ID</code> and <code>targetitemquant</code> were treated as c strings but the error occurs on <code>targetitem</code> and <code>targetitemquant</code>.</p>