Невозможно скомпилировать код gstreamer в Eclipse IDE - PullRequest
0 голосов
/ 25 октября 2019

Я новичок в gstreamer и gcc. Я пытаюсь скомпилировать следующий код C

#include <gst/gst.h>

int main(int argc, char *argv[]){
//Gst Object needed for gstreamer to work
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;

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


/* Build pipeline */
pipeline = gst_parse_launch ("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/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, 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;
}

В соответствии с руководством gstreamer я могу скомпилировать код на терминале eclipse, используя

gcc ../gstreamer-pipeline.c -o gstreamer-pipeline `pkg-config --cflags --libs gstreamer-1.0`

Настройка проекта eclipse для

GCC C компилятор имеет следующие параметры

-I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -O0

GCC C Linker имеет следующие параметры

-lgstreamer-1.0 -lgobject-2.0 -lglib-2.0

Вывод ошибки консоли, который я получаю

23:20:42 **** Incremental Build of configuration Release for project GStreamer ****
make all 
Building file: ../gstreamer-pipeline.c
Invoking: GCC C Compiler
gcc -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -O0 -MMD -MP -MF"gstreamer-pipeline.d" -MT"gstreamer-pipeline.o" -o "gstreamer-pipeline.o" "../gstreamer-pipeline.c"
/tmp/cc4Mc8m3.o: In function `gst_message_unref':
gstreamer-pipeline.c:(.text+0x14): undefined reference to `gst_mini_object_unref'
subdir.mk:18: recipe for target 'gstreamer-pipeline.o' failed
/tmp/cc4Mc8m3.o: In function `main':
gstreamer-pipeline.c:(.text+0x39): undefined reference to `gst_init'
gstreamer-pipeline.c:(.text+0x4a): undefined reference to `gst_parse_launch'
gstreamer-pipeline.c:(.text+0x5f): undefined reference to `gst_element_set_state'
gstreamer-pipeline.c:(.text+0x6b): undefined reference to `gst_element_get_bus'
gstreamer-pipeline.c:(.text+0x87): undefined reference to `gst_bus_timed_pop_filtered'
gstreamer-pipeline.c:(.text+0xaa): undefined reference to `gst_object_unref'
gstreamer-pipeline.c:(.text+0xbb): undefined reference to `gst_element_set_state'
gstreamer-pipeline.c:(.text+0xc7): undefined reference to `gst_object_unref'
collect2: error: ld returned 1 exit status
make: *** [gstreamer-pipeline.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

23:20:43 Build Failed. 11 errors, 0 warnings. (took 234ms)

Пожалуйста, дайте мне знать, что я делаю неправильно.

...