-1
YAxis::YAxis() {
    TextWriter *tw = new MBTextWriter;
    Create(Y_AXIS_WIDTH, Y_AXIS_HEIGHT);
    SetPosition(Y_AXIS_STARTING_X, Y_AXIS_STARTING_Y);
    SetFocus();
    SetColor(114, 114, 114);
    for (unsigned int y = 0; y < Y_AXIS_HEIGHT / GRID_CELL_HEIGHT; y++) {
        if (y >= 10)
            tw->SetPosition(8, y * GRID_CELL_HEIGHT + 14);
        else
            tw->SetPosition(8, y * GRID_CELL_HEIGHT + 9);
        tw->SetMessage(toString(y));
        tw->Write(); 
    }
}

这个错误似乎以这个构造函数为中心,但我看不到它。任何帮助,将不胜感激。

这里的完整错误:

Editor/YAxis.cpp: In constructor ‘YAxis::YAxis()’:
Editor/YAxis.cpp:6:33: error: expected ‘)’ before ‘;’ token
Editor/YAxis.cpp:6:50: error: expected primary-expression before ‘)’ token
Editor/YAxis.cpp:6:50: error: expected ‘;’ before ‘)’ token

如果您需要有关我尝试使用此代码完成的工作的更多信息,请告诉我。

4

1 回答 1

2

如果第 6 行是这一行:

for (unsigned int y = 0; y < Y_AXIS_HEIGHT / GRID_CELL_HEIGHT; y++) {

问题可能出在宏的定义中:

  • Y_AXIS_HEIGHT
  • GRID_CELL_HEIGHT

你能提供他们的内容吗?

于 2013-10-08T12:32:12.120 回答