title: How to fix undefined reference to symbol 'dlclose@@GLIBC_2.2.5' from glad.c
body: <p>I am learning Opengl by following the tutorial at <a href="https://learnopengl.com/" rel="noreferrer">https://learnopengl.com/</a>
  and I am having trouble setting up dependency with cmake(<a href="https://learnopengl.com/Getting-started/Creating-a-window" rel="noreferrer">See Creating a window</a>).</p>
  <p>I based my CMakeLists.txt on the <a href="https://www.glfw.org/docs/latest/build_guide.html#build_link_cmake_package" rel="noreferrer">GLFW documentation</a>.</p>
  <pre><code>cmake_minimum_required(VERSION 3.14)
  project(openglTuto)
  
  
  include_directories(include)
  add_executable(gltuto src/main.c src/glad.c)
  
  find_package(glfw3 3.3 REQUIRED)
  find_package(OpenGL REQUIRED)
  
  target_link_libraries(gltuto glfw)
  target_include_directories(gltuto PUBLIC ${OPENGL_INCLUDE_DIR})
  target_link_libraries(gltuto ${OPENGL_gl_LIBRARY})
  
  </code></pre>
  <p>CMake succeed in building my configuration but ninja fail to compile and print an error.</p>
  <blockquote>
  <p>[1/1] Linking C executable gltuto</p>
  <p>FAILED: gltuto
  : &amp;&amp; /usr/bin/cc    CMakeFiles/gltuto.dir/src/main.c.o CMakeFiles/gltuto.dir/src/glad.c.o  -o gltuto  /usr/lib/libglfw.so.3.3 &amp;&amp; :</p>
  <p>/usr/bin/ld: CMakeFiles/gltuto.dir/src/glad.c.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'</p>
  <p>/usr/bin/ld: /usr/lib/libdl.so.2: error adding symbols: DSO missing from command line</p>
  <p>collect2: error: ld returned 1 exit status</p>
  <p>ninja: build stopped: subcommand failed.</p>
  </blockquote>