Linux pkg config--libs返回一个.la文件,但g++;can';我受不了

Linux pkg config--libs返回一个.la文件,但g++;can';我受不了,linux,g++,ld,libtool,Linux,G++,Ld,Libtool,我正试图从git构建一些针对GStreamer的东西。他们有一些神奇的过程,可以让pkg config开心,但是如果我运行它,我会得到一个.la文件: $ pkg-config --libs gstreamer-1.0 /home/blong/gst/head/gstreamer/gst/libgstreamer-1.0.la -lgobject-2.0 -lglib-2.0 这给GCC带来了问题: g++ -o example switchtrackexample.cpp `pkg-conf

我正试图从git构建一些针对GStreamer的东西。他们有一些神奇的过程,可以让
pkg config
开心,但是如果我运行它,我会得到一个
.la
文件:

$ pkg-config --libs gstreamer-1.0
/home/blong/gst/head/gstreamer/gst/libgstreamer-1.0.la -lgobject-2.0 -lglib-2.0
这给GCC带来了问题:

g++ -o example switchtrackexample.cpp `pkg-config --libs --cflags gstreamer-1.0`
# comes out as: g++ -o example switchtrackexample.cpp -pthread -I/home/blong/gst/head/gstreamer -I/home/blong/gst/head/gstreamer/libs -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include /home/blong/gst/head/gstreamer/gst/libgstreamer-1.0.la -lgobject-2.0 -lglib-2.0
/usr/bin/ld: error: /home/blong/gst/head/gstreamer/gst/libgstreamer-1.0.la:8:8: invalid character
/usr/bin/ld: error: /home/blong/gst/head/gstreamer/gst/libgstreamer-1.0.la:8:8: syntax error, unexpected $end
/usr/bin/ld: error: /home/blong/gst/head/gstreamer/gst/libgstreamer-1.0.la: not an object or archive
# lots of undefined references here

我读过一些东西,建议我应该能够使用
libtool
来编译它,但我不知道如何编译。我该怎么处理这个
.la
文件呢?

在我问了这个问题后,我发现Julien Moutte:

添加:
libtool--mode=link
在构建命令前面。

根据这条建议,我得到了这样一条有效的建议:

libtool --mode=link g++ -o example switchtrackexample.cpp `pkg-config --cflags --libs gstreamer-1.0`