这段代码中cuberotateUP CLOCKWISE;报错Error cube was not declared in this scope; did you mean Cube是为什么应该怎么改#include iostream#include vector#include stringusing namespace std; 定义魔方的颜色enum Color RED BLUE GREEN
在ThistlethwaiteSolver类中的solveTopCross函数中,需要使用Cube对象cube来调用rotate函数,但是在函数中未定义cube对象,因此会报错'cube' was not declared in this scope。需要在函数中声明一个Cube对象,并将其作为参数传入函数中,或者将cube对象作为ThistlethwaiteSolver类的成员变量来定义并初始化。例如:
class ThistlethwaiteSolver {
private:
Cube cube;
public:
void solve(CubeState state) {
// ...
}
void solveTopCross() {
// ...
cube.rotate(face, rotation);
// ...
}
};
原文地址: https://www.cveoy.top/t/topic/b1lI 著作权归作者所有。请勿转载和采集!