如何解决:“ const char *”类型的参数与“ char *”类型的参数不兼容?

时间:2019-05-15 15:52:54

标签: c++ visual-studio-2017 char

在执行OpenGL项目时出现此错误

  

const char *与char *类型的参数不兼容

//  variables representing the window size
int window_width = 706;
int window_height = 706;
//  variable representing the window title
const char *window_title = "Snake";
void init_setup(int width, int height, char *windowName)
{
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    centerOnScreen();
    glutInitWindowSize(window_width, window_height);// init. window size
    glutInitWindowPosition(window_x, window_y); // init. window position
    glutCreateWindow(windowName);   // window name
    glutReshapeFunc(reshape_handler);  // sets the reshape call back
}    // end of init_setup()

int main(int argc, char **argv)
{
glutInit(&argc, argv);
init_setup(window_width, window_height, window_title); //ERROR OCCURS HERE
glutMainLoop();
}

0 个答案:

没有答案