Undefined references linking program in linux

I have compiled GLFW successfully but when trying to compile (actually link) a simple test program I get a storm of “undefined reference” errors referring to various X functions, Vulkan, and several dl* functions. As far as I know I have no mention of Vulkan. I’m linking with -lX11, libglfw3.a, and various OpenGL .o files.

Suggestions welcomed!

Make sure you’re passing linker flags in correct order. Argument order in GNU linker matters. All libraries like -lX11 or -ldl must come after files they are used in.

Thanks for the tip. Rearranging the library calls fixed the problem.