Linking error: undefined reference to glXSwapIntervalEXT

I am trying to call glXSwapIntervalEXT in my Linux application.

I declared GLX_GLXEXT_PROTOTYPES in the user definitions, and the header file is found. However, my program cannot link due to an undefined reference to this function.

I am trying this text in the compiler options in Code::Bliocks:
-lGLEW -lglut -lGL -lGLU -lXext

I also tried adding “/usr/lib/x86_64-linux-gnu/libGLEW.so.1.6” in the linker settings, but to no avail.

Any idea what I need to add to make this build?

This should be defined by your libGL library, not GLEW.

Try:


> nm -Do /usr/lib64/libGL.so | grep glXSwapIntervalEXT
/usr/lib64/libGL.so:000000000007d3c0 T glXSwapIntervalEXT

> nm -Do /usr/lib/libGL.so | grep glXSwapIntervalEXT
/usr/lib/libGL.so:00062100 T glXSwapIntervalEXT

> glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 560 Ti/PCIe/SSE2
OpenGL version string: 4.4.0 NVIDIA 325.05.14
OpenGL shading language version string: 4.40 NVIDIA via Cg compiler
OpenGL extensions:

Are you compiling 32-bit or 64-bit? Check the appropriate library in that case.

/usr/lib/x86_64-linux-gnu/libGLEW.so.1.6

That’s a really odd path. Why are your GLEW libs stuffed in that dir?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.