为什么我的乘法被视为指针?

时间:2014-10-11 10:53:33

标签: c++

编辑:我看了一眼简单的错误,并没有想到。忽略:))

我的代码显示错误:

no match for 'operator*' in 'mapRows * width'

代码

// get the current tile number
  int tileNumber = levelMap[mapRows*width + currentTile];

宣布于:

for (auto& mapRows : levelMap)
        for (auto& currentTile : mapRows)  //It loops through the rows, then goes through all the tiles in that column.
        {

和宽度:

bool Map::load(const std::string& tileset, sf::Vector2u tileSize, unsigned int width, unsigned int height)

和levelMap at:

std::vector<std::vector<Tile>> levelMap;

对不起,只是一个初学者!

1 个答案:

答案 0 :(得分:2)

mapRows似乎是std::vector<Tile>,与int的乘法没有意义。这就是错误告诉你的。