So I am trying to compile a basic application and when i try and compile it, it throws an error:
$ g++ -g -Iinclude -ldl -lX11 -lstdc++ src/*.cpp src/*.c `pkg-config --cflags --libs glfw3 glib-2.0`
/usr/bin/ld: warning: librt.so.1, needed by /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libglfw.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: /tmp/ccJamhTZ.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
main.cpp:
#include <glad/glad.h>
#include <GLFW/glfw3.h>
int main(int argc, char** argv) {
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
return 0;
}
What causes this and how do I fix it?