Unexplained Error in GLUT Render

I have this code:

static void cbRenderScene() {
    glClear(GL_COLOR_BUFFER_BIT);
    glutSwapBuffers();
}

/* entry point - Glut initializes with arguments*/
int main(
    int argc, char** argv, bool WithDepth, bool WithStencil) {
	/* Initialize the library */
    bool sWithDepth = WithDepth;
    bool sWithStencil = WithStencil;
    }

    /* initialize glut */
    glutInit(&argc, argv);

    /* set display mode 
    using double buffer for animation and color with alpha */
    glutInitDisplayMode(
        GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);

    /* set window size and position*/
    glutInitWindowSize(800, 600);
    glutInitWindowPosition(100, 100); // from bottom left

    /* create window (returns integer handle starting at 1 */
    glutCreateWindow("WindowTitle");

    /* use "main" callback to do all the rendering of one frame. 
    This function is continuously called by GLUT internal loop. */
    glutDisplayFunc(cbRenderScene);

    /* set color to be used when clearing the framebuffer */
    GLclampf R = 0.0f, G = 0.0f, B = 0.0f, A = 1.0f;
    glClearColor(R, G, B, A);

    /* passes control to GLUT which now begins its own 
    internal loop. In this loop it listens to events from 
    the windowing system and passes them via the callbacks */
    glutMainLoop();
}

On RenderScene, the program exits with an error.

Exception thrown at 0x0000000000000000 in ProjectCpp.exe: 0xC0000005: Access violation executing location 0x0000000000000000.

I don’t know what causes the error.
Can someone help, please.

I solved the problem by removing GLAD, which I did not realize was included.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.