g++ -w qbx.cpp  -framework OpenGL -framework IOKit -framework GLUT -framework OpenGL -framework Cocoa  -o 

(below for reference purposes only, above is minimum viable)
g++ -w qbx.cpp -framework ApplicationServices -framework OpenGL -framework IOKit -framework CoreServices -framework CoreFoundation -framework GLUT -framework OpenGL -framework Cocoa  -o 