Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GStreamer C++ on Visual Studio 2010?

Following instructions on http://docs.gstreamer.com/display/GstSDK/Installing+on+Windows to install GStreamer and compile tutorials/examples on Windows 7, for compilation using Visual Studio 2010.

After installing the SDKs, I try to compile the "hello world" example...

Cannot open include file: 'gst/gst.h': No such file or directory.  

Odd - the tutorials were supposedly configured with the paths to these files. Nevertheless, we can manually add them...

Add C:\gstreamer-sdk\0.10\x86\include\gstreamer-0.10 to project include directories

Cannot open include file: 'glib.h': No such file or directory

Add C:\gstreamer-sdk\0.10\x86\include\glib-2.0 to project include directories

Cannot open include file: 'glibconfig.h': No such file or directory

At this point it seems to be a dead-end, as there isn't a glibconfig.h file anywhere on PC.

Was some step missing from the gstreamer documents?

p.s. I see a similar question, but its accepted answer seems to be a dead-link.

like image 209
OJW Avatar asked Jan 21 '14 17:01

OJW


2 Answers


This question was posted on 2014. However, for everyone that needs to install Gstreamer on Visual Studio , I am explaining how you configure your library on Windows.

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.

like image 177
astarakastara Avatar answered Sep 22 '22 06:09

astarakastara


(1) Install Windows Driver Development Kit

(2) When creating new projects, use the "gstreamer" template in Visual Studio, rather than the "Windows application" template. Then it doesn't need anything changing in the include/linker settings to make #include <gst/gst.h> work properly.

like image 40
OJW Avatar answered Sep 20 '22 06:09

OJW