Unresolved External Symbol Error when building OpenCV on Windows with GStreamer

I’m trying to build OpenCV 4.9.0 (https://github.com/opencv/opencv/archive/4.9.0.zip) with GStreamer 1.24.2 on Window 10 Home (x64) with Visual Studio 22 Community Edition. For this I’ve installed both runtime and development installer of GStreamer MSVC 64-bit, VS 2019, Release CRT (both under ‘complete installation’ setting). Which lead to addition of the following system environment variables automatically:

GST_PLUGIN_PATH: C:\gstreamer\1.0\msvc_x86_64\lib\gstreamer-1.0
GSTREAMER_1_0_ROOT_MSVC_X86_64: C:\gstreamer\1.0\msvc_x86_64\

I’ve manually made the following additions to the path variable under system variables:

C:\gstreamer\1.0\msvc_x86_64\bin
C:\gstreamer\1.0\msvc_x86_64\lib
C:\gstreamer\1.0\msvc_x86_64\lib\gstreamer-1.0

Next I launch CMake 3.29.2 GUI, add an additional GSTREAMER_DIR variable pointing to “C:/gstreamer/1.0/msvc_x86_64” (without this some includes paths are not automatically picked up when I configure the project) and configure, generate and launch my project in VS2022 with build mode selected as “release”.

Here I’m receiving the following linking errors:

Can anyone please help me with any additional linking steps required to compile this? The OpenCV itself seems to compile just fine if I turn off WITH_GSTREAMER.

I’ve tried the same with mingw64, msys2-ucrt64, vcpkg but unfortunately just can’t seem to get any of it working. Also, if it doesn’t go off-topic (since this query has been filed under C++ section), if there is an easier way to get gstreaming backend running with opencv-python on windows, please let me know.

Thank You.

With some hit & trail and looking at the source code files of the GStreamer, I figured out it was C:\gstreamer\1.0\msvc_x86_64\lib\gstapp-1.0.lib that needed to be added as an that needed to be added as additional dependency in opencv_gapi, opencv_test_gapi, opencv_videoio projects in my case.

In case someone is looking for more detailed instructions: Goto modules>opencv_gapi, right-click and select ‘Properties’. In the Linker>Input section click on ‘additional dependencies’ field, click edit and add C:\gstreamer\1.0\msvc_x86_64\lib\gstapp-1.0.lib there. Repeat the same for modules>opencv_videoio and tests accuracy>opencv_test_gapi.