土壤异常 c++

发布于 2025-01-07 16:44:33 字数 953 浏览 0 评论 0原文

当我制作游戏时,一切都很顺利,但突然我在土壤的加载图片上出现了一个奇怪的异常。 这不是在比赛开始时发生的,而是突然发生的,这很奇怪。

这是一张图片: http://oi39.tinypic.com/vgj9y.jpg

这里是代码:

bool window::loadTex(std::string fName, int fNum)
{
        textur[fNum] = SOIL_load_OGL_texture
            (
            (char*)fName.c_str(),
            SOIL_LOAD_AUTO,
            SOIL_CREATE_NEW_ID,
            SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y 
            );
        if(textur[fNum] == 0)
            return false;
        return true;
}

和函数调用:

if(!loadTex(std::string("data/back.png"), 0))
        printf("Can't load image");

太奇怪了...当异常发生时,我没有做任何与土壤有关的事情。

Dissambly 中有更多相关信息,有帮助吗?

First-chance exception at 0x784FFDEE (msvcr100.dll) in ConsoleApplication6.exe: 0xC0000005: Access violation reading location 0x00000000.

固定的!多谢!

when I made my game, all went fine, but suddenly I had a weird exception on the load picture of soil.
It didn't happened in the start of the game, it happened suddenly, it was very weird.

here a picture:
http://oi39.tinypic.com/vgj9y.jpg

here the code:

bool window::loadTex(std::string fName, int fNum)
{
        textur[fNum] = SOIL_load_OGL_texture
            (
            (char*)fName.c_str(),
            SOIL_LOAD_AUTO,
            SOIL_CREATE_NEW_ID,
            SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y 
            );
        if(textur[fNum] == 0)
            return false;
        return true;
}

and the function call:

if(!loadTex(std::string("data/back.png"), 0))
        printf("Can't load image");

it is so weird... when the exception happened, I didn't do anything that related to soil.

There is more information about it in the Dissambly, may it help?

First-chance exception at 0x784FFDEE (msvcr100.dll) in ConsoleApplication6.exe: 0xC0000005: Access violation reading location 0x00000000.

Fixed! thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清君侧 2025-01-14 16:44:33

这没什么奇怪的。您遇到运行时错误。可能在您的代码中的某个地方您超出了一些内存,这就是问题表现出来的方式。您需要在代码中找到问题。

查找问题的一种方法是使用调试器查看崩溃的对象出了什么问题。也许那里的指针之一具有无效值。如果这个包含垃圾的指针的地址在运行之间是一致的,您可以在其地址上放置一个数据断点,并在每次遇到数据断点时查看谁正在更改它以及它是错误还是正常健康流动。

There's nothing weird about it. You have a run time error. Probably somewhere in your code you overrun some memory and this is the way the problem manifested itself. You need to find the problem in your code.

One way to find the problem is to look with the debugger what is wrong with objects where the crash is. Maybe one of the pointers there have invalid value. If the address of this pointer that has garbage in it is consistent between runs, you can put a data break point on its address and see, every time you hit the data break point, who is changing it and whether it's an error or normal healthy flow.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文