foo.cc:18:29: error: 'Matrix3' does not name a type
18 | Vector3 operator*(const Matrix3& matrix) const {
| ^~~~~~~
foo.cc: In member function 'Vector3 Vector3::operator*(const int&) const':
foo.cc:19:29: error: request for member 'v' in 'matrix', which is of non-class type 'const int'
19 | int x_ = x * matrix.v[0][0] + y * matrix.v[1][0] + z * matrix.v[2][0];
| ^
foo.cc:19:50: error: request for member 'v' in 'matrix', which is of non-class type 'const int'
19 | int x_ = x * matrix.v[0][0] + y * matrix.v[1][0] + z * matrix.v[2][0];
| ^
foo.cc:19:71: error: request for member 'v' in 'matrix', which is of non-class type 'const int'
19 | int x_ = x * matrix.v[0][0] + y * matrix.v[1][0] + z * matrix.v[2][0];
| ^
foo.cc:20:29: error: request for member 'v' in 'matrix', which is of non-class type 'const int'
20 | int y_ = x * matrix.v[0][1] + y * matrix.v[1][1] + z * matrix.v[2][1];
| ^
foo.cc:20:50: error: request for member 'v' in 'matrix', which is of non-class type 'const int'
20 | int y_ = x * matrix.v[0][1] + y * matrix.v[1][1] + z * matrix.v[2][1];
| ^
foo.cc:20:71: error: request for member 'v' in 'matrix', which is of non-class type 'const int'
20 | int y_ = x * matrix.v[0][1] + y * matrix.v[1][1] + z * matrix.v[2][1];
| ^
foo.cc:21:29: error: request for member 'v' in 'matrix', which is of non-class type 'const int'
21 | int z_ = x * matrix.v[0][2] + y * matrix.v[1][2] + z * matrix.v[2][2];
| ^
foo.cc:21:50: error: request for member 'v' in 'matrix', which is of non-class type 'const int'
21 | int z_ = x * matrix.v[0][2] + y * matrix.v[1][2] + z * matrix.v[2][2];
| ^
foo.cc:21:71: error: request for member 'v' in 'matrix', which is of non-class type 'const int'
21 | int z_ = x * matrix.v[0][2] + y * matrix.v[1][2] + z * matrix.v[2][2];
| ^
foo.cc: In function 'int main()':
foo.cc:80:25: error: no match for 'operator*' (operand types are 'Vector3' and 'Matrix3')
80 | Vector3 result2 = v * m;
| ~ ^ ~
| | |
| | Matrix3
| Vector3
foo.cc:18:13: note: candidate: 'Vector3 Vector3::operator*(const int&) const'
18 | Vector3 operator*(const Matrix3& matrix) const {
| ^~~~~~~~
foo.cc:18:38: note: no known conversion for argument 1 from 'Matrix3' to 'const int&'
18 | Vector3 operator*(const Matrix3& matrix) const {
| ~~~~~~~~~~~~~~~^~~~~~
正在同步测试数据,请稍后
[Hydro](https://hydro.ac)提供评测服务