【发布时间】:2016-10-12 17:46:59
【问题描述】:
我正在使用 F11 键(Step Into 模式)调试给定的 C++ 代码,以便了解调用代码中函数的精确顺序,我意识到 它除非我在函数定义中的某行设置断点,否则永远不会进入某些函数。
我的意思是,如果我从 main 方法中调用一个函数,并且该函数是在另一个 .cpp 中定义的,我希望 F11 调试模式可以逐步进入在函数内部以分析变量的变化。大多数时候它会这样做,但在某些情况下它只是执行函数而不进入它,并跳转到 main 方法中的下一行。
为什么会这样?
示例:
这是 F11 永远不会进入的功能:
void VirtualCamera::display (void) {
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Clear the background of the window
glClear(GL_COLOR_BUFFER_BIT); //Clear the colour buffer (more buffers later on)
glLoadIdentity(); // Load the Identity Matrix to reset our drawing locations
glTranslatef(0.0f, 0.0f, -5.0f);
renderPrimitive(); // Render the primitive
glFlush(); // Flush the OpenGL buffers to the window
}
这是F11一步一步走的主要方法:
void VirtualCamera::CameraMain(int argc, char **argv){
glutInit(&argc, argv); // Initialize GLUT
glutInitDisplayMode (GLUT_SINGLE);
glutInitWindowSize (500, 500); // Set the width and height of the window
glutInitWindowPosition (100, 100); // Set the position of the window
glutCreateWindow ("OpenGL Window"); // Set the title for the window
glutDisplayFunc(display); // Tell GLUT to use the method "display" for rendering
glutReshapeFunc(reshape);
glutMainLoop(); // Enter GLUT's main loop
}
【问题讨论】:
标签: c++ visual-studio-2008 visual-studio-debugging