我正在調試一個給定的C++代碼,使用F11鍵(Step Into模式),以便了解代碼中函數被調用的精確順序,並且我意識到它絕不會進入某些函數內部,除非我在函數定義的某一行設置一個斷點。爲什麼Visual Studio的調試模式Step Into(F11)有時不會進入某些功能內?
我的意思是,如果我請從主方法的功能,並且該功能在另一個的.cpp I所定義期望F11調試模式由函數內部步驟以analize變量輸入步驟變化。大部分時間都是這樣,但在某些情況下,它只是執行函數而不進入它,並跳轉到主方法中的下一行。
這是怎麼發生的?
實施例:
這是函數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
}
我沒有選中,但無論如何感謝。我的意思是我期望當F11到達'glutMainLoop()'這一行時也會進入函數顯示,但它只會在display(void)內設置一個斷點。 – 2012-01-30 15:10:35