3

I am using Windows 10. I am unable to configure Visual Studio 2017 to run basic Gstreamer tutorials. I am getting errors like 'cannot open gst/gst.h'. I am using gstreamer 1.0.

Please help.

3 Answers3

15


Hello my friend.

First of you need to download the library from https://gstreamer.freedesktop.org/data/pkg/windows/

You need to download and install both installers for developers and non-developers.

For instance for 1.14 it is the now latest version,

  • gstreamer-1.0-devel-x86-1.14.1.msi
  • gstreamer-1.0-x86-1.14.1.msi

You will install and setup both of them in the same directory like C:\gstreamer. (I guess gstreamer automatically adds its /bin to the Path environment. If not just ask it.)

After that you will open your Visual Studio. Create your C++ project. Create your main.cpp file. Right click on your project and click properties.

We need to do 3 steps:

  1. Include the necessary directory paths.
  2. Define the where the .lib paths are.
  3. Specify which .libs you want to use.

After clicking properties:

  1. C/C++ -> Additional Include Directories -> define your include paths such as
C:\gstreamer\1.0\x86_64\lib\glib-2.0\include;C:\gstreamer\1.0\x86_64\include\gstreamer-1.0;C:\gstreamer\1.0\x86_64\include\glib-2.0\;C:\gstreamer\1.0\x86_64\include\glib-2.0\glib;%(AdditionalIncludeDirectories)
  1. Linker -> General -> Adding Library Directories -> write your lib directory path such as
C:\gstreamer\1.0\x86_64\lib;%(AdditionalLibraryDirectories)
  1. Linker -> Input -> Additional Dependencies -> Write your .lib files you want to use such as
gobject-2.0.lib;glib-2.0.lib;gstreamer-1.0.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)

gobject-2.0.lib;glib-2.0.lib;gstreamer-1.0.lib are the ones we added, others are done by default.


That's all. You can just write in your main.cpp file

#include <gst/gst.h> and use your GStreamer Library

I think this will work for almost all libraries.

jmcker
  • 387
  • 4
  • 18
astarakastara
  • 475
  • 5
  • 17
  • although the question is about the tutorials: For some simple encoding+streaming code I had to add gstapp-1.0.lib and gstvideo-1.0.lib. Maybe someone can use this information instead of searching in the > 500 files lib folder... – Micka Apr 21 '21 at 08:03
2

I'd prefer to comment on astarakastara's answer.. but don't have the reputation yet.

Note that you probably want to use the "MSVC" version of the install files: "gstreamer-1.0-devel-msvc-x86_64-1.16.1.msi" "gstreamer-1.0-msvc-x86_64-1.16.1.msi"

These are new since his/her answer, and include .pbd debugging files made for debugging in visual studio.

Matthew Czarnek
  • 341
  • 3
  • 13
1

Also we need add dll path in the properties

  1. Go to Properties->Debugging->Environment
  2. Add PATH=C:\path\where\gstreamer\dll\is;$(PATH) For ex- PATH=C:\gstreamer\1.0\msvc_x86_64\bin;$(PATH)