未明确引用Gstreamer函数C ++ Ubuntu

时间:2015-02-19 16:58:42

标签: c++ eclipse ubuntu gstreamer

我正在尝试使用C ++编译Gstreamer SDK教程1:Hello World应用程序

我遇到了很多问题,但在我收到所有包含文件后,我仍然遇到问题。

Ubuntu最受支持的发行版是" Ubuntu Raring Ringtail(13.04)"对于Gstreamer SDK,我使用这些x64存储库

安装它

我正在运行Ubuntu 14.04 x64并且包似乎安装正常。

以下是我的代码(适用于C ++):

#include <stdio.h>
#include <gst/gst.h>

//using namespace std;

int main(int argc, char *argv[])
{
  GstElement *pipeline;
  GstBus *bus;
  GstMessage *msg;

  /* Initialize GStreamer */
  gst_init (&argc, &argv);

  /* Build the pipeline */
  pipeline = gst_parse_launch("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);

  /* Start playing */
  gst_element_set_state (pipeline, GST_STATE_PLAYING);

  /* Wait until error or EOS */
  bus = gst_element_get_bus (pipeline);
  msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, (GstMessageType)(GST_MESSAGE_ERROR | GST_MESSAGE_EOS));

  /* Free resources */
  if (msg != NULL)
    gst_message_unref (msg);
  gst_object_unref (bus);
  gst_element_set_state (pipeline, GST_STATE_NULL);
  gst_object_unref (pipeline);
  return 0;
}

这是我与g ++调用相关的错误:

11:46:28 **** Build of configuration Debug for project gst-test ****
make all 
Building file: ../main.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/include/libxml2 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -O0 -g3 -Wall -c -fmessage-length=0  `pkg-config  --cflags --libs gstreamer-0.10` -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
Finished building: ../main.cpp

Building target: gst-test
Invoking: GCC C++ Linker
g++  -o "gst-test"  ./main.o   
./main.o: In function `gst_message_unref':
/usr/include/gstreamer-0.10/gst/gstmessage.h:347: undefined reference to `gst_mini_object_unref'
./main.o: In function `main':
/home/kyle/workspace/gst-test/Debug/../main.cpp:19: undefined reference to `gst_init'
/home/kyle/workspace/gst-test/Debug/../main.cpp:22: undefined reference to `gst_parse_launch'
/home/kyle/workspace/gst-test/Debug/../main.cpp:25: undefined reference to `gst_element_set_state'
/home/kyle/workspace/gst-test/Debug/../main.cpp:28: undefined reference to `gst_element_get_bus'
/home/kyle/workspace/gst-test/Debug/../main.cpp:29: undefined reference to `gst_bus_timed_pop_filtered'
/home/kyle/workspace/gst-test/Debug/../main.cpp:34: undefined reference to `gst_object_unref'
/home/kyle/workspace/gst-test/Debug/../main.cpp:35: undefined reference to `gst_element_set_state'
/home/kyle/workspace/gst-test/Debug/../main.cpp:36: undefined reference to `gst_object_unref'
collect2: error: ld returned 1 exit status
make: *** [gst-test] Error 1

这是我的pkg-config输出:

pkg-config --cflags --libs gstreamer-0.10
-pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libxml2  -pthread -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lxml2 -lglib-2.0 

我尝试了很多东西但是我能找到的最接近我的问题是:

Issues linking against gstreamer libraries ubuntu 11.10

并且: http://lists.freedesktop.org/archives/gstreamer-devel/2009-May/022575.html

感谢您的帮助,如果这是愚蠢的话我很抱歉我仍然是C ++的新手

0 个答案:

没有答案