发布版本的GLUI运行时错误

GLUI runtime error with release build

本文关键字:GLUI 运行时错误 版本 布版本      更新时间:2023-10-16

我正在使用GLUI开发我的第一个应用程序,我遇到了一些问题。我在一台Windows 7电脑上使用Visual Studio 2010,使用的是glui-2.35。我的应用程序在调试模式下运行良好,但在发布模式下构建时出现运行时错误而崩溃。从调试器来看,错误来自于glui.cpp:

函数中的最后一条语句。
void GLUI_Master_Object::set_glutReshapeFunc(void (*f)(int width, int height))
{
  glutReshapeFunc( glui_reshape_func );
  add_cb_to_glut_window( glutGetWindow(), GLUI_GLUT_RESHAPE, (void*) f);
}

我不确定为什么发布构建崩溃;如有任何建议,不胜感激。

我不是msvc++调试和发布模式的专家,但我一直在寻找一些信息,在这个网站上,一些用户谈论它。

其中一个(@mcdeeiis),在这个页面上说:

...
In a debug build the complete symbolic debug information is emitted to help while debugging applications and also the code optimization is not taken into account. 
While in release build the symbolic debug info is not emitted and the code execution is optimized.
Also, because the symbolic info is not emitted in a release build, the size of the final executable is lesser than a debug executable.
One can expect to see funny errors in release builds due to compiler optimizations or differences in memory layout or initialization. These are usually referred to as Release...

无论如何,检查GLUI或您的项目所依赖的库是否也已以发布模式编译。