Hi all,
I am having a issue when trying to compile a simple code that should work without problems.I tried a simple programme on gstreamer-0.10 it was working fine but when i moved to gstreamer-1.4.5 on RHEL-7.2 it gives error like this g++ tect.c -o test 'pkg-config --cflags --libs gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-interfaces-1.0' test.c:(.text+0xd): undefined reference to `gst_message_get_type' test.c:(.text+0x64): undefined reference to `gst_message_parse_error' /tmp/cccrQH9p.o: In function `on_pad_added': test.c:(.text+0xdd): undefined reference to `gst_element_get_static_pad' test.c:(.text+0xf1): undefined reference to `gst_pad_link' test.c:(.text+0xff): undefined reference to `gst_object_unref' /tmp/cccrQH9p.o: In function `main': test.c:(.text+0x12b): undefined reference to `gst_init' test.c:(.text+0x17c): undefined reference to `gst_pipeline_new' test.c:(.text+0x194): undefined reference to `gst_element_factory_make' test.c:(.text+0x1ac): undefined reference to `gst_element_factory_make' test.c:(.text+0x1c4): undefined reference to `gst_element_factory_make' test.c:(.text+0x1dc): undefined reference to `gst_element_factory_make' test.c:(.text+0x1f4): undefined reference to `gst_element_factory_make' test.c:(.text+0x26c): undefined reference to `gst_pipeline_get_type' test.c:(.text+0x285): undefined reference to `gst_pipeline_get_bus' test.c:(.text+0x29e): undefined reference to `gst_bus_add_watch' test.c:(.text+0x2ac): undefined reference to `gst_object_unref' test.c:(.text+0x2b4): undefined reference to `gst_bin_get_type' test.c:(.text+0x2de): undefined reference to `gst_bin_add_many' test.c:(.text+0x2ef): undefined reference to `gst_element_link' test.c:(.text+0x302): undefined reference to `gst_element_link_many' test.c:(.text+0x34e): undefined reference to `gst_element_set_state' test.c:(.text+0x38c): undefined reference to `gst_element_set_state' test.c:(.text+0x3a4): undefined reference to `gst_object_get_type' test.c:(.text+0x3bd): undefined reference to `gst_object_unref' Here is the code #include <gst/gst.h> int main(int argc, char *argv[]) { GstElement *pipeline, *source, *sink, *convert,*encoder; GstBus *bus; GstMessage *msg; GstStateChangeReturn ret; /* Initialize GStreamer */ gst_init (&argc, &argv); /* Create the elements */ source = gst_element_factory_make ("v4l2src", "source"); sink = gst_element_factory_make ("autovideosink", "sink"); convert =gst_element_factory_make("ffmpegcolorspace","convert"); // encoder = gst_element_factory_make ("ffenc_mpeg4","mpeg-decoder"); encoder = gst_element_factory_make ("x264enc","encoder"); /* Create the empty pipeline */ pipeline = gst_pipeline_new ("test-pipeline"); if (!pipeline || !source || !sink || !convert) { g_printerr ("Not all elements could be created.\n"); return -1; } /*set der source*/ g_object_set (source, "device", "/dev/video0", NULL); /* Build the pipeline */ gst_bin_add_many (GST_BIN (pipeline), source, sink, convert, NULL); if (gst_element_link (convert, sink) != TRUE) { g_printerr ("Elements could not be linked confert sink.\n"); gst_object_unref (pipeline); return -1; } if (gst_element_link (source, convert) != TRUE) { g_printerr ("Elements could not be linked source -convert.\n"); gst_object_unref (pipeline); return -1; } /* Start playing */ ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); if (ret == GST_STATE_CHANGE_FAILURE) { g_printerr ("Unable to set the pipeline to the playing state.\n"); gst_object_unref (pipeline); return -1; } /* Wait until error or EOS */ bus = gst_element_get_bus (pipeline); msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_EOS); /* Parse message */ if (msg != NULL) { GError *err; gchar *debug_info; switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_ERROR: gst_message_parse_error (msg, &err, &debug_info); g_printerr ("Error received from element %s: %s\n", GST_OBJECT_NAME (msg->src), err->message); g_printerr ("Debugging information: %s\n", debug_info ? debug_info : "none"); g_clear_error (&err); g_free (debug_info); break; case GST_MESSAGE_EOS: g_print ("End-Of-Stream reached.\n"); break; default: /* We should not reach here because we only asked for ERRORs and EOS */ g_printerr ("Unexpected message received.\n"); break; } gst_message_unref (msg); } /* Free resources */ gst_object_unref (bus); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (pipeline); return 0; } Library also pasted correctly in bash.rc since the same pgm is working well with gstreamer-0.10. Can some body tell me what is the problem ? |
Free forum by Nabble | Edit this page |