GStreamer:与标头相关的编译错误 gst-interfaces 包
我是一个相对较新的程序员,所以如果这是一个相当愚蠢的问题,请原谅我。
我刚刚编写了一个中等规模的程序,但编译时遇到了一些问题。 我的包含看起来像这样:
#include <glib.h>
#include <glib-object.h>
#include <X11/Xlib.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <gst/gst.h>
#include <gst/interfaces/xoverlay.h>
加上一些其他自定义头文件(两个,用于我正在使用的几个 GObject)
并且我正在尝试使用以下命令行:
gcc -Wall (my source files) -o (my output) `pkg-config --cflags --libs gdk gtk+-2.0 glib-2.0 gobject-2.0 gstreamer-0.10 x11`
我进行了很多编译错误(远远超过 1000 个),所有这些错误都与我正在使用的库有关。 大多数看起来像:
/usr/include/glib-2.0/gobject/gtype.h:367: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'
/usr/include/glib-2.0/gobject/gobject.h:199: error: expected ')' before '*' token
/usr/include/glib-2.0/gobject/gsignal.h:262: error: expected declaration specifiers or '...' before 'GSignalFlags'
等等,等等。
任何帮助将非常感激。我确信这是某种愚蠢的错误,无论是链接还是包含,但我就是无法弄清楚。
I'm a relatively new programmer, so forgive me if this is a rather stupid question.
I just wrote a medium-scale program, and I'm having some trouble compiling.
My includes look like this:
#include <glib.h>
#include <glib-object.h>
#include <X11/Xlib.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <gst/gst.h>
#include <gst/interfaces/xoverlay.h>
Plus some other custom header files (two, for a couple of GObjects I'm using)
And I'm trying to use the following command line:
gcc -Wall (my source files) -o (my output) `pkg-config --cflags --libs gdk gtk+-2.0 glib-2.0 gobject-2.0 gstreamer-0.10 x11`
I get a lot of compiling errors (well over 1000), all of them related to the libraries I'm using.
Most of them look like:
/usr/include/glib-2.0/gobject/gtype.h:367: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'
/usr/include/glib-2.0/gobject/gobject.h:199: error: expected ')' before '*' token
/usr/include/glib-2.0/gobject/gsignal.h:262: error: expected declaration specifiers or '...' before 'GSignalFlags'
And so on, and so forth.
Any help would be very much appreciated. I'm sure it's some kind of stupid mistake, either with the linking, or the includes, but I just can't figure it out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看第一个错误并忽略其他错误。
一种可能性是第一个错误表示未找到其中一个#include。如果是这样,只需修复它,一大堆错误很可能是由该问题产生的。
也许您在 pkg-config 命令行上缺少所需的模块之一,例如 gstreamer-interfaces-0.10 也许只是猜测。
Look at the very first error and ignore the others.
One possibility is that the first error says one of the #include was not found. If so, just fix that, a whole bunch of the errors are likely to be fallout from that problem.
Perhaps you are missing one of the needed modules on your pkg-config command line, such as gstreamer-interfaces-0.10 perhaps, just a guess.
不确定这是否有帮助,但我也遇到了同样的错误。 (我正在使用 XCode 3.2.5 for mac 进行开发)。
我想构建一个链接到我的 macports 库 /opt/local/lib 和 /opt/local/include 的应用程序,
我执行了以下操作。
在“目标”下,双击目标应用程序
在“搜索路径”下,
一个。始终搜索用户路径 [关闭]
b.标头搜索路径 [ 将路径添加到标头位置 ] 例如。 /usr/local/include/x
c.库搜索路径 [将路径添加到您的共享库]
编译并运行,应该修复错误
如果您不确定库在哪里,请使用 pkg -config 来找到它们。
pkg-config 用法:
pkg-config --cflags
ex:pkg-config --cflags glib-2.0
然后你可以查看这些目录,看看是否包含缺少的依赖项,然后将路径添加到搜索路径下的“标题”或“库”路径。
希望这有帮助。
Not sure if this helps, but I had the same errors. (I'm developing with XCode 3.2.5 for mac).
I wanted to build an application that linked against my macports libraries /opt/local/lib, and /opt/local/include
I did the following.
Under Targets, double-click the Target App
Under 'Search Paths',
a. Always Search User Paths [off]
b. Header Search Paths [ add the path(s) to your header location(s) ] ex. /usr/local/include/x
c. Library Search Paths [ add the path(s) to your shared Libraries ]
compile and run, should fix the errors
If you are not sure where the libraries are, use pkg-config to find them.
pkg-config usage:
pkg-config --cflags
ex: pkg-config --cflags glib-2.0
Then you can look at these directories, see if the missing dependency is included, then add the path to either the 'headers' or 'library' paths under Search Paths.
Hope this helps.
没有代码很难说。但我敢打赌,可能缺少分号,或者宏中存在错误。即使在不属于您自己的代码中,它总是会生成这些奇怪的消息。
仔细检查您自己的代码,也许尝试添加更多调试标志,例如 -W* 系列(请参阅 GCC)
Difficult to say without the code. But I'd bet on a missing semi-colon, or error in a macro maybe. That always generates those kinds of weird messages, even in code that's not your own.
Double check your own code, maybe try to add more debug flag such as -W* family (see GCC)