-1

i was building an app with OpenGL i got this

/usr/bin/ld: /usr/local/lib/libglfw3.a(monitor.c.o): in function `glfwSetGamma':
monitor.c:(.text+0x111a): undefined reference to `powf'
/usr/bin/ld: /usr/local/lib/libglfw3.a(x11_monitor.c.o): in function `calculateRefreshRate':
x11_monitor.c:(.text+0xf4): undefined reference to `round'
collect2: error: ld returned 1 exit status

how do i fix this?

Same
  • 1
  • 1
  • 2
    You need to add `-lm` to your invocation of the linker. Depending on your code structure and build environment, you might just need to add it to the end of whatever you do to build the executable. `-lm` tells the linker to link the math library, which is where `powf()` and `round()` can be found. – pmacfarlane Aug 16 '23 at 23:01
  • When you ask about a link error, show the link command. – Eric Postpischil Aug 16 '23 at 23:11

0 Answers0