VC6.0下libpng报错

发布于 2024-11-29 01:29:27 字数 734 浏览 4 评论 0原文

我在 OpenGL 项目中使用 libpng 在 Windows XP 下使用 VC6.0 加载 png 文件的纹理。 构建没问题,运行时出现错误。 错误是

the instruction at 0x0040b4a3 referenced memory at 0x00000008 the memory could not be written

我尝试重新启动但错误仍然存​​在。我已经将exe文件放到另一个xp桌面上,错误仍然存​​在。

调试时,我发现这个语句出错了:(通常与libpng一起使用)

png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_PACKING | PNG_TRANSFORM_EXPAND, png_voidp_NULL);

错误消息是

Unhandled exception in test.exe(NTDLL.DLL): 0xc0000005: Access Violation.

我的代码工作很好在fedora下使用g++,但是在windows XP下的VC6.0下出现问题。


源代码很大,不知道哪里出了问题,所以不知道在这里粘贴什么代码。
有人对此有任何想法吗?
如果您能在这方面帮助我,我将非常感激。谢谢! :)

I'm using libpng in my OpenGL project to load texture of png file with VC6.0 under windows xp.
It's OK to build and error occurs during running.
The error is

the instruction at 0x0040b4a3 referenced memory at 0x00000008 the memory could not be written

I've tried to reboot but error remains. And I've put the exe file to another xp desktop and error remains.

When debugging, I found this statement went wrong: (which is usually used with libpng)

png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_PACKING | PNG_TRANSFORM_EXPAND, png_voidp_NULL);

Error message is

Unhandled exception in test.exe(NTDLL.DLL): 0xc0000005: Access Violation.

My code works fine with g++ under fedora, but something is wrong under VC6.0 with windows XP.

Source code is very large and I don't know what goes wrong, so I don't know what code to paste here.

Does any one has any idea about this?

I'll be very grateful if you can help me on this. Thx! :)

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

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

发布评论

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

评论(1

淡写薰衣草的香 2024-12-06 01:29:28

你检查过传递给函数的指针吗?其中之一的值可能是 8 而不是某个有效的内存地址。如果传递到 libpng 的数据正常,则错误可能在其他地方。

小旁注:有什么理由使用 VC++ 6.0 而不是任何较新的(免费的)Express 版本?

Did you check the pointers passed into the function? One of them might have the value 8 instead of some valid memory address. If the data passed into libpng is fine, the error might be somewhere else.

Minor side note: Any reason for using VC++ 6.0 over any of the newer (and free) Express Editions?

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