使用指针表达式 必须具有类类型错误 c++
working with pointers Expression Must have class type error c++
>#include "stdafx.h"
>#include <Windows.h>
>#include <iostream>
using namespace std;
HANDLE pHandle;
class Player
{
public:
//Client Player
DWORD_PTR clientPlayer;
char Name[0x10];
unsigned int m_teamId;
//ClientControllableEntity
DWORD_PTR clientSoldier;
BYTE isOccluded;
//ClientSoldierReplication
DWORD_PTR clientReplication;
int state;
//LifeModule
DWORD_PTR healthcomponent;
FLOAT health;
};
class LocalPlayer : public Player
{
public:
DWORD_PTR VehicleVelocityA;
DWORD_PTR VehicleVelocityB;
DWORD_PTR VehicleVelocityC;
INT VehicleSpeed;
};
LocalPlayer lPlayer;
int readSpeed(LocalPlayer* localPlayer){
ReadProcessMemory(pHandle, (void*)(localPlayer->clientSoldier + 0x0280), &localPlayer->VehicleVelocityA, sizeof(localPlayer->VehicleVelocityA), NULL);
ReadProcessMemory(pHandle, (void*)(localPlayer->clientSoldier + 0x0284), &localPlayer->VehicleVelocityB, sizeof(localPlayer->VehicleVelocityB), NULL);
ReadProcessMemory(pHandle, (void*)(localPlayer->clientSoldier + 0x0288), &localPlayer->VehicleVelocityC, sizeof(localPlayer->VehicleVelocityC), NULL);
double VelocityAX = pow(localPlayer->VehicleVelocityA.x, 2);
double VelocityBX = pow(localPlayer->VehicleVelocityB.x, 2);
double VelocityCX = pow(localPlayer->VehicleVelocityC.x, 2);
localPlayer->VehicleSpeed = 0;
localPlayer->VehicleSpeed = sqrt(VelocityAX + VelocityBX + VelocityCX) * 3.6f;
}
有人可以帮我处理上面的代码吗?我得到表达式必须在这些行有类错误
double VelocityAX = pow(localPlayer->VehicleVelocityA.x, 2);
double VelocityBX = pow(localPlayer->VehicleVelocityB.x, 2);
double VelocityCX = pow(localPlayer->VehicleVelocityC.x, 2);
它告诉我本地玩家必须具有类类型。有人可以帮我调试这段代码吗,它困扰了我几个小时。
DWORD_PTR是一个指针,而不是一个结构。这就是为什么它给出错误的原因。 pow
期望double
或float
的函数。
将VehicleVelocityA
和其他变量声明为 double
或 float
或结构包含x
为 double
或 float
。
相关文章:
- 类没有命名C++代码中的类型错误
- 不完整类型错误(E0409、E0070、E0515)
- 使用具有结构不完整类型错误的模板
- 不命名构造函数和析构函数上的类型错误
- 返回派生类型时出现协变类型错误
- 为什么此构造函数没有给出不完整的类型错误?
- 定义模板化结构的特征时出现不完整的类型错误
- 使用重载构造函数时出现不完整的类型错误
- 为什么我得到表达式必须有类类型错误?
- 输出 [left]=input[i] 行中的 c++ 代码中存在无效的类型错误
- 枚举成员不是类型错误
- 如何修复"ctypes"。参数错误:参数 2:<键入"异常.类型错误">:RaspberryPi 中的错误类型"错误
- 外部 "C" Visual Studio 2015 中的显式类型错误,DLL 测试代码
- 非默认析构函数会导致不完整的类型错误
- 为什么按引用传入会导致绑定引用类型错误
- Objective-C C++ 包装器 类型错误的不完整定义
- 输入类型错误
- 当构造函数的参数类型错误时引发异常
- 命名空间中的'bad_cast' 'std' 未命名类型错误
- C UNWORKOWN类型错误