freeglut throws error "failed to open display''

Sorry for my rudimentary question.

Environment:

・Xcode 15.3

・C++

・Freeglut 3.4.0

・XQuartz 2.8.6_beta2 (already started)

Current status:

The following problems occurred at the time of upgrading from Xcode 14.2 to Xcode 15.3. Despite setting DISPLAY appropriately in the user environment variable, an error message " failed to open display '' " is thrown when RUN with Xcode. However, if I run the binary built with Xcode directly in the terminal, it works fine.

Question:

Why is the DISPLAY environment variable not being passed to Xcode internals properly when RUN in Xcode?

freeglut throws error "failed to open display''
 
 
Q