OpenGL: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'

Share:
## undefined reference to symbol 'dlclose@@GLIBC_2.2.5' ```sh /usr/bin/ld: CMakeFiles/example.dir/glad.c.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status CMakeFiles/example.dir/build.make:124: recipe for target 'example' failed make[2]: *** [example] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/example.dir/all' failed make[1]: *** [CMakeFiles/example.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2 ``` ## Solution: Add ${CMAKE_DL_LIBS} ```sh target_link_libraries(gltuto PUBLIC glfw OpenGL::GL ${CMAKE_DL_LIBS}) ``` ## Reference: - https://stackoverflow.com/questions/56841870/how-to-fix-undefined-reference-to-symbol-dlcloseglibc-2-2-5-from-glad-c ![yubao_blog_cover](https://raw.githubusercontent.com/yubaoliu/assets/image/yubao_blog_cover.png)

No comments