简体   繁体   English

Visual Studio 2010 上的 GStreamer C++?

[英]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.按照http://docs.gstreamer.com/display/GstSDK/Installing+on+Windows上的说明在 Windows 7 上安装 GStreamer 并编译教程/示例,以便使用 Visual Studio 2010 进行编译。

After installing the SDKs, I try to compile the "hello world" example...安装 SDK 后,我尝试编译“hello world”示例...

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将 C:\\gstreamer-sdk\\0.10\\x86\\include\\gstreamer-0.10 添加到项目包含目录

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将 C:\\gstreamer-sdk\\0.10\\x86\\include\\glib-2.0 添加到项目包含目录

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.在这一点上,它似乎是一个死胡同,因为 PC 上的任何地方都没有 glibconfig.h 文件。

Was some step missing from the gstreamer documents? gstreamer 文档中是否缺少某些步骤?

ps I see a similar question , but its accepted answer seems to be a dead-link. ps 我看到一个类似的问题,但它接受的答案似乎是一个死链接。


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.这个问题是在 2014 年发布的。但是,对于需要在 Visual Studio 上安装 Gstreamer 的每个人,我将解释您如何在 Windows 上配置您的库。

First of you need to download the library from https://gstreamer.freedesktop.org/data/pkg/windows/首先你需要从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,例如对于 1.14 它是现在的最新版本,

  • gstreamer-1.0-devel-x86-1.14.1.msi gstreamer-1.0-devel-x86-1.14.1.msi
  • gstreamer-1.0-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 .您将在C:\\gstreamer等同一目录中安装和设置它们。 (I guess gstreamer automatically adds its /bin to the Path environment. If not just ask it.) (我猜 gstreamer 会自动将其/bin添加到 Path 环境中。如果不是直接问它。)

After that you will open your Visual Studio.之后,您将打开 Visual Studio。 Create your C++ project.创建您的 C++ 项目。 Create your main.cpp file.创建您的main.cpp文件。 Right click on your project and click properties.右键单击您的项目,然后单击属性。

We need to do 3 steps:我们需要做3个步骤:

  1. Include the necessary directory paths.包括必要的目录路径。
  2. Define the where the .lib paths are.定义.lib路径所在的位置。
  3. Specify which .libs you want to use.指定要使用的.libs

After clicking properties:点击属性后:

  1. C/C++ -> Additional Include Directories -> define your include paths such as C/C++ -> 附加包含目录 -> 定义包含路径,例如
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链接器 -> 常规 -> 添加库目录 -> 写下你的 lib 目录路径如
C:\gstreamer\1.0\x86_64\lib;%(AdditionalLibraryDirectories)
  1. Linker -> Input -> Additional Dependencies -> Write your .lib files you want to use such as Linker -> Input -> Additional Dependencies -> 编写你想要使用的 .lib 文件,例如
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. gobject-2.0.lib;glib-2.0.lib;gstreamer-1.0.lib是我们添加的,其他都是默认完成的。


That's all.就这样。 You can just write in your main.cpp file你可以只写在你的main.cpp文件中

#include <gst/gst.h> and use your GStreamer Library #include <gst/gst.h>并使用您的 GStreamer 库

I think this will work for almost all libraries.我认为这几乎适用于所有图书馆。

(1) Install Windows Driver Development Kit (1)安装Windows驱动开发包

(2) When creating new projects, use the "gstreamer" template in Visual Studio, rather than the "Windows application" template. (2)新建项目时,使用Visual Studio中的“gstreamer”模板,而不是“Windows应用程序”模板。 Then it doesn't need anything changing in the include/linker settings to make #include <gst/gst.h> work properly.然后它不需要在包含/链接器设置中进行任何更改来使#include <gst/gst.h>正常工作。

Windows 上的标准 gstreamer 安装有一个 glibconfig.h 位于:(假设您的 gstreamer 安装在 C:\\gstreamer) C:\\gstreamer\\1.0\\x86_64\\lib\\glib-2.0\\include

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM