G
G
Gokilla2018-09-19 23:00:15
visual studio
Gokilla, 2018-09-19 23:00:15

The compiler swears?

void__ Scene2::DrawNumeric(int__ num,int__ position)
{
  int__ j = -1,jj=-1;
  std::string str = "";
  for (auto && v : std::to_string(num)) {
    //std::cout << v /*- '0'*/ << "|";
    str += v;
    ++j;
    switch (str[j])
    {
    case '0':
    {
      glBindTexture(GL_TEXTURE_2D, IndexTexture[62]);
      EnableTexture(NewTextureCoordinats[0], NewVertexCoordinats[63+position], j);
      break;
    }
    case '1':
    {
      glBindTexture(GL_TEXTURE_2D, IndexTexture[63]);
      EnableTexture(NewTextureCoordinats[0], NewVertexCoordinats[63 + position], j);
      break;
    }
    case '2':
    {
      glBindTexture(GL_TEXTURE_2D, IndexTexture[64]);
      EnableTexture(NewTextureCoordinats[0], NewVertexCoordinats[63 + position], j);
      break;
    }
    case '3':
    {
      glBindTexture(GL_TEXTURE_2D, IndexTexture[65]);
      EnableTexture(NewTextureCoordinats[0], NewVertexCoordinats[63 + position], j);
      break;
    }
    case '4':
    {
      glBindTexture(GL_TEXTURE_2D, IndexTexture[66]);
      EnableTexture(NewTextureCoordinats[0], NewVertexCoordinats[63 + position], j);
      break;
    }
    case '5':
    {
      glBindTexture(GL_TEXTURE_2D, IndexTexture[67]);
      EnableTexture(NewTextureCoordinats[0], NewVertexCoordinats[63 + position], j);
      break;
    }
    case '6':
    {
      glBindTexture(GL_TEXTURE_2D, IndexTexture[68]);
      EnableTexture(NewTextureCoordinats[0], NewVertexCoordinats[63 + position], j);
      break;
    }
    case '7':
    {
      glBindTexture(GL_TEXTURE_2D, IndexTexture[69]);
      EnableTexture(NewTextureCoordinats[0], NewVertexCoordinats[63 + position], j);
      break;
    }
    case '8':
    {
      glBindTexture(GL_TEXTURE_2D, IndexTexture[70]);
      EnableTexture(NewTextureCoordinats[0], NewVertexCoordinats[63 + position], j);
      break;
    }
    case '9':
    {
      glBindTexture(GL_TEXTURE_2D, IndexTexture[71]);
      EnableTexture(NewTextureCoordinats[0], NewVertexCoordinats[63 + position], j);
      break;
    }
    }
  }
}

errors in visual 2015 everything is ok, but in 2010 here in the line with for:
Error 11 error C2143: syntax error: missing "," before ":" E:\flash drive\other\nottoch\Tropic-Island\Tropic-Island\game3 \research_very_goodZZZ\Scene2.cpp 452
Error 12 error C2530: v: links must be initialized E:\stick\other\nottoch\Tropic-Island\Tropic-Island\game3\research_very_goodZZZ\Scene2.cpp 452
Error 13 error C3531: v: a character whose type contains the "auto" specifier must have the initializer E:\stick\other\nottoch\Tropic-Island\Tropic-Island\game3\research_very_goodZZZ\Scene2.cpp 452
Error 14 error C2143: syntax error: missing ";" before "{" E:\stick\other\nottoch\Tropic-Island\Tropic-Island\game3\research_very_goodZZZ\Scene2.cpp 452

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Gordienko, 2018-09-21
@RdSpclL

The compiler, which is in the 2010 studio, most likely simply does not know that it is already possible to write like this.
for (auto && v : std::to_string(num))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question