title: How to write a CMAKE file which successfully links gstreamer basic tutorial 5
body: <p>I'm trying to write a CMAKE file which will compile the code found <a href="https://gstreamer.freedesktop.org/documentation/tutorials/basic/toolkit-integration.html?gi-language=c" rel="nofollow noreferrer">here</a>.</p>
  <p>My current CMAKE file looks like this and has successfully compiled and linked the previous tutorials. It also compiles this one but when linking I get the following error:</p>
  <pre><code>undefined reference to `gst_video_overlay_get_type'
  undefined reference to `gst_video_overlay_set_window_handle'
  </code></pre>
  <p>The CMAKE file looks like so:</p>
  <pre><code>cmake_minimum_required(VERSION 3.18)
  project(gstreamer)
  
  set(CMAKE_CXX_STANDARD 20)
  
  find_package(PkgConfig REQUIRED)
  pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
  
  pkg_search_module(GST REQUIRED gstreamer-1.0&gt;=1.4
          gstreamer-sdp-1.0&gt;=1.4
          gstreamer-app-1.0&gt;=1.4
          gstreamer-video-1.0&gt;=1.4
          )
  
  
  add_executable(gstreamer main.cpp)
  
  target_include_directories(gstreamer PRIVATE ${GTK3_INCLUDE_DIRS} ${GST_INCLUDE_DIRS})
  target_link_libraries(gstreamer ${GTK3_LIBRARIES} ${GST_LIBRARIES})
  </code></pre>
  <p>Other SO posts have suggested linking <code>gstreamer-video-1.0</code> which I believe I am in:</p>
  <pre><code>target_link_libraries(gstreamer ${GST_LIBRARIES})
  </code></pre>
  <p>If I've misunderstood how PkgConfig works I'd much appreciate an explanation.</p>
  <p>Thanks</p>