嗨,我最近使用 DirectX9,遇到了这个错误。虽然它与 DirectX 无关。这就是我所拥有的。
struct D3DVertex
{
float x, y, z;
DWORD Color;
};
int main()
{
D3DVertex *TestShape = new D3DVertex();
TestShape[0].x = 0.0f;
TestShape[0].y = 2.0f;
TestShape[0].z = 0.5f;
TestShape[0].Color = 0xffffffff;
TestShape[1].x = -2.0f;
TestShape[1].y = -2.0f;
TestShape[1].z = 0.5f;
TestShape[1].Color = 0xffffffff;
TestShape[2].x = 2.0f;
TestShape[2].y = -2.0f;
TestShape[2].z = 0.5f;
TestShape[2].Color = 0xffffffff;
return 0;
}
当我运行它时,它会给我一个运行时错误,上面写着这个。
Windows has triggered a breakpoint in x.exe.
This may be due to a corruption of the heap, which indicates a bug in x.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while x.exe has focus.
The output window may have more diagnostic information.
但是当我拿走这条线时TestShape[2].z = 0.5f;
,错误就消失了。为什么会发生这种情况,我该如何解决。请帮忙。