3

I am trying to add freeglut to my program but I didn't find any way to do that. In MacOs to add glut library and glu i had to compile from terminal with :

g++-9 -framework GLUT -framework OpenGL

My purpose was to add freeglut in order to use glutLeaveMainLoop() in my program. So I added the Library but i get this error:

Undefined symbols for architecture x86_64:
  "_glutLeaveMainLoop"
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

I had the same errors when I tried compiling my program without adding -framework OpenGL -framework GLUT

Is it possible to compile with g++ using also freeglut ?

Jatos
  • 333
  • 2
  • 13
  • 1
    A good crossplatform alternative to glut is glfw. Its really nice for widows and context creation, and has support for both callbacks and event polling. This answer may worth looking at too for a quick rundown of differences, https://stackoverflow.com/questions/25708688/what-is-the-difference-between-freeglut-vs-glfw – David Sullivan Oct 20 '20 at 05:13

1 Answers1

2

Since MacOs doesn't have a freeglut library itself, after downloading the library with brew, I solved the problem myself by adding the -L and the -l :

g++-9 -framework GLUT -framework OpenGL -L /usr/local/Cellar/freeglut/3.0.0/lib -lglut file.cpp

Jatos
  • 333
  • 2
  • 13