对链接库的GStreamer问题的Ubuntu 11.10 [英] Issues linking against gstreamer libraries ubuntu 11.10

查看:543
本文介绍了对链接库的GStreamer问题的Ubuntu 11.10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

于是我开始说是要利用的GStreamer库的项目。我正在从GStreamer的文档的测试项目,并正在以下error.This程序工作正常上的archlinux但示数出在Ubuntu

  GCC`pkg配置--cflags --libs的GStreamer-0.10`的main.c -o球员
/tmp/cciFhGCe.o:在函数'主':
main.c中:(文字+ 0X1E):未定义的参考`gst_init
。main.c中:(文字+ 0x36数据):未定义的参考`gst_version
collect2:劳工处返回1退出状态
使:*** [播放]错误1

我的code是这是我从GStreamer的文档

得到了以下

 的#include<&stdio.h中GT;
#包括LT&; GST / gst.h>INT
主(INT ARGC,
      的char * ARGV [])
{
  常量gchar * nano_str;
  guint主要,次要,微,纳米;  gst_init(安培; ARGC,&安培; argv的);  gst_version(安培;大,与放;未成年人,和放大器;微,&安培;纳米);  如果(纳米== 1)
    nano_str =(CVS);
  否则如果(纳米== 2)
    nano_str =($ P $租赁前的);
  其他
    nano_str =;  的printf(这个程序是对的GStreamer%d个。%d个链接。%d个%S \\ n,
          主要,次要,微型,nano_str);  返回0;
}

和我使用的编译命令

  GCC`pkg配置--cflags --libs的GStreamer-0.10`的main.c -o球员

和pkg配置的输出

  -pthread -I / usr / include目录/巧舌如簧-2.0 -I / usr / lib目录/ x86_64的-Linux的GNU /油嘴-2.0 /包括-I / usr / include目录/ GStreamer的-0.10 -I / usr / include目录/ -pthread的libxml2 -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lxml2 -lgthread-2.0 -lrt -lglib-2.0


解决方案

所以,感谢freenode上#gstreamer的伟大的球员

在unbuntu GCC的版本一些更改了pkg配置语句的顺序进行。

  GCC`pkg配置的GStreamer-0.10 --cflags`的main.c -o player.out`pkg配置的GStreamer-0.10 --libs`

使用此格式固定它。

So I am starting a project that is going to make use of the gstreamer libraries. I am running the test project from the gstreamer documentation and am getting the following error.This program worked properly on archlinux but is erroring out on ubuntu

gcc `pkg-config --cflags --libs gstreamer-0.10` main.c -o player
/tmp/cciFhGCe.o: In function `main':
main.c:(.text+0x1e): undefined reference to `gst_init'
main.c:(.text+0x36): undefined reference to `gst_version'
collect2: ld returned 1 exit status
make: *** [player] Error 1

My code is the following which I got from the gstreamer documentation

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

int
main (int   argc,
      char *argv[])
{
  const gchar *nano_str;
  guint major, minor, micro, nano;

  gst_init (&argc, &argv);

  gst_version (&major, &minor, &micro, &nano);

  if (nano == 1)
    nano_str = "(CVS)";
  else if (nano == 2)
    nano_str = "(Prerelease)";
  else
    nano_str = "";

  printf ("This program is linked against GStreamer %d.%d.%d %s\n",
          major, minor, micro, nano_str);

  return 0;
}

and the command I am using to compile is

gcc `pkg-config --cflags --libs gstreamer-0.10` main.c -o player

and the output of pkg-config

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

解决方案

So thanks to the great guys on freenode #gstreamer

In unbuntu's version of gcc some changes were made to the ordering of pkg-config statements.

gcc `pkg-config gstreamer-0.10 --cflags` main.c -o player.out `pkg-config gstreamer-0.10 --libs`

Using this format fixed it.

这篇关于对链接库的GStreamer问题的Ubuntu 11.10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆