简体   繁体   中英

macOS Catalina 10.15 xcode openGL not running window?

I am working on a c++ project with openGL on Xcode, my code is build successful. But there is no display window?

My Xcode settings here;

My first post - > Here

I need help, and my codes;


#include"GL/glew.h"
#include"GL/freeglut.h"
#include<iostream>
#define GLEW_STATIC

void display(void) {

}
int main(int argc, char *argv[]) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
    glutInitWindowPosition(500, 200); //glut penceresinin ekran konumu
    glutInitWindowSize(500, 350); //glut penceresinin boyutları
    glutCreateWindow("OpenGL Merhaba Dunya");
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}


And Xcode print its terminal this error message;


freeglut (/Users/ismailyavuz/Library/Developer/Xcode/DerivedData/ornek-acjymofglobglnbdyttjfdcvjwya/Build/Products/Debug/ornek): failed to open display ''
Program ended with exit code: 1

I research and find it. You need the XQuartz for running windows.

Visit this web site: https://www.xquartz.org

Download and install it.

It's working for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM