request for member 'x' in 'c', which is of non-class type 'int'
时间: 2023-12-23 10:05:44 浏览: 35
这个错误通常表示你试图在一个非类类型的变量上调用类成员函数或变量。在这个错误信息中,`x` 应该是一个类成员变量,而 `c` 是一个 `int` 类型的变量,因此你不能在 `c` 上调用 `x` 成员变量。
可能的原因是你错误地使用了一个变量,或者你的代码中存在语法错误。请检查你的代码并确保你正确地使用了类成员变量和函数。如果你仍然无法解决问题,请提供更多的代码和错误信息以供参考。
相关问题
[Error] request for member 'pos' in 'k', which is of non-class type 'int'
This error occurs when you try to access the member variable 'pos' of an object 'k', but 'k' is not a class or struct type. This means that 'k' is probably defined as an integer or some other primitive data type, which does not have any member variables.
To fix this error, you need to make sure that 'k' is of a class or struct type that actually has a 'pos' member variable. Alternatively, you may need to adjust your code to use a different variable or approach that is appropriate for the data type of 'k'.
error: request for member 'Compare' in 'n', which is of non-class type 'int'|
这个错误通常是因为你尝试在一个非类类型的变量上调用一个成员函数。在你的代码中,变量 `n` 被声明为 `int` 类型,但是你尝试在它上面调用一个名为 `Compare` 的成员函数。这是不合法的,因为 `int` 类型没有 `Compare` 成员函数。
如果你想在一个类中使用 `Compare` 函数,你需要确保这个函数是该类的成员函数,并且你要在类的对象上调用它。如果你只是想在一个普通的函数中使用 `Compare` 函数,你需要将其定义为一个非成员函数,并传递任何必要的参数。