1

When I try to compile a program using OpenGL on MacOSX I get the error message 'ld: library not found for -lopengl32' and 'clang: error: linker command failed with exit code 1 (use -v to see invocation)', which I'm guessing is caused by the library not being found. The code works on Windows, but not on Mac. I'm using CodeBlocks 13.12.

I have tried to install OpenGL using the commands

brew install glfw3

and

brew install glew

but I still get the same error.

I have tried this on a Windows system and there it works out of the box.

What do I need to do to install the missing library?

Jenny
  • 13
  • 2
  • Possible duplicate of [Compiling a C program that uses OpenGl in Mac OS X](https://stackoverflow.com/questions/18550265/compiling-a-c-program-that-uses-opengl-in-mac-os-x) – Indiana Kernick Apr 20 '19 at 08:46

1 Answers1

1

opengl32 is the name of the API library on Windows. On macOS you have to use -framework OpenGL instead of -lopengl32. And for reference, on Linux it's either -lGL (linking to the traditional LSB defined libGL.so) or -lOpenGL (linking against GLVND).

datenwolf
  • 159,371
  • 13
  • 185
  • 298