title: Box2d - Variable length array of non-POD element type 'b2Vec2'
body: <p>I'm working on a importer for a game of mine, it reads an xml and then creates the box2d bodies for everything.</p>
  
  <p>For example</p>
  
  <pre><code>  &lt;polygon vertexCount="3" density="0" friction="0.25" restitution="0.30000000000000004"&gt;
        &lt;vertice x="6.506500000000001" y="0.4345"/&gt;
        &lt;vertice x="6.534970527648927" y="0.48385302734375"/&gt;
        &lt;vertice x="6.478029472351075" y="0.48385302734375"/&gt;
    &lt;/polygon&gt;
  </code></pre>
  
  <p>The problem is in the exporter I'm now facing the polygon part, I need to setup a b2vec2 array before adding the vertices and setting their positions.</p>
  
  <pre><code>int count = [[childnode attributeForName:@"vertexCount"] intValue];
  b2Vec2 points[count];
  </code></pre>
  
  <p>but box2d wants the points[5] to be an actual literal number (like points[5] instead of a variable points[number], the error it outputs when I have the variable count in there is:</p>
  
  <pre><code> Variable length array of non-POD element type 'b2Vec2'
  </code></pre>
  
  <p>How do I solve this? I tried making it a constant but that doesn't work either (and doesn't help me since I need it to be dynamic).</p>