<br>Mates, I am having a issue when trying to compile a simple code that should work without problems. <br>I have it running in other machines, but I can&#39;t figure out what it might be.<br><br><br>This is the output:<br>
<br>bash-3.1# gcc -Wall $(pkg-config --cflags --libs gstreamer-0.10) spectrum.c <br>/tmp/cccrQH9p.o: In function `bus_call&#39;:<br>spectrum.c:(.text+0xd): undefined reference to `gst_message_get_type&#39;<br>spectrum.c:(.text+0x64): undefined reference to `gst_message_parse_error&#39;<br>
/tmp/cccrQH9p.o: In function `on_pad_added&#39;:<br>spectrum.c:(.text+0xdd): undefined reference to `gst_element_get_static_pad&#39;<br>spectrum.c:(.text+0xf1): undefined reference to `gst_pad_link&#39;<br>spectrum.c:(.text+0xff): undefined reference to `gst_object_unref&#39;<br>
/tmp/cccrQH9p.o: In function `main&#39;:<br>spectrum.c:(.text+0x12b): undefined reference to `gst_init&#39;<br>spectrum.c:(.text+0x17c): undefined reference to `gst_pipeline_new&#39;<br>spectrum.c:(.text+0x194): undefined reference to `gst_element_factory_make&#39;<br>
spectrum.c:(.text+0x1ac): undefined reference to `gst_element_factory_make&#39;<br>spectrum.c:(.text+0x1c4): undefined reference to `gst_element_factory_make&#39;<br>spectrum.c:(.text+0x1dc): undefined reference to `gst_element_factory_make&#39;<br>
spectrum.c:(.text+0x1f4): undefined reference to `gst_element_factory_make&#39;<br>spectrum.c:(.text+0x26c): undefined reference to `gst_pipeline_get_type&#39;<br>spectrum.c:(.text+0x285): undefined reference to `gst_pipeline_get_bus&#39;<br>
spectrum.c:(.text+0x29e): undefined reference to `gst_bus_add_watch&#39;<br>spectrum.c:(.text+0x2ac): undefined reference to `gst_object_unref&#39;<br>spectrum.c:(.text+0x2b4): undefined reference to `gst_bin_get_type&#39;<br>
spectrum.c:(.text+0x2de): undefined reference to `gst_bin_add_many&#39;<br>spectrum.c:(.text+0x2ef): undefined reference to `gst_element_link&#39;<br>spectrum.c:(.text+0x302): undefined reference to `gst_element_link_many&#39;<br>
spectrum.c:(.text+0x34e): undefined reference to `gst_element_set_state&#39;<br>spectrum.c:(.text+0x38c): undefined reference to `gst_element_set_state&#39;<br>spectrum.c:(.text+0x3a4): undefined reference to `gst_object_get_type&#39;<br>
spectrum.c:(.text+0x3bd): undefined reference to `gst_object_unref&#39;<br>collect2: ld returned 1 exit status<br><br><br><br clear="all">I have the PKG_CONFIG_PATH duly configured and gstreamer-0.10 libraries are installed. What am I missing here??????<br>
<br>This is the code:<br><br>#include &lt;gst/gst.h&gt;<br>#include &lt;glib.h&gt;<br><br><br>static gboolean<br>bus_call (GstBus     *bus,<br>          GstMessage *msg,<br>          gpointer    data)<br>{<br>  GMainLoop *loop = (GMainLoop *) data;<br>
<br>  switch (GST_MESSAGE_TYPE (msg)) {<br><br>    case GST_MESSAGE_EOS:<br>      g_print (&quot;End of stream\n&quot;);<br>      g_main_loop_quit (loop);<br>      break;<br><br>    case GST_MESSAGE_ERROR: {<br>      gchar  *debug;<br>
      GError *error;<br><br>      gst_message_parse_error (msg, &amp;error, &amp;debug);<br>      g_free (debug);<br><br>      g_printerr (&quot;Error: %s\n&quot;, error-&gt;message);<br>      g_error_free (error);<br><br>
      g_main_loop_quit (loop);<br>      break;<br>    }<br>    default:<br>      break;<br>  }<br><br>  return TRUE;<br>}<br><br><br>static void<br>on_pad_added (GstElement *element,<br>              GstPad     *pad,<br>              gpointer    data)<br>
{<br>  GstPad *sinkpad;<br>  GstElement *decoder = (GstElement *) data;<br><br>  /* We can now link this pad with the vorbis-decoder sink pad */<br>  g_print (&quot;Dynamic pad created, linking demuxer/decoder\n&quot;);<br>
<br>  sinkpad = gst_element_get_static_pad (decoder, &quot;sink&quot;);<br><br>  gst_pad_link (pad, sinkpad);<br><br>  gst_object_unref (sinkpad);<br>}<br><br><br><br>int<br>main (int   argc,<br>      char *argv[])<br>{<br>
  GMainLoop *loop;<br><br>  GstElement *pipeline, *source, *demuxer, *decoder, *conv, *sink;<br>  GstBus *bus;<br><br>  /* Initialisation */<br>  gst_init (&amp;argc, &amp;argv);<br><br>  loop = g_main_loop_new (NULL, FALSE);<br>
<br><br>  /* Check input arguments */<br>  if (argc != 2) {<br>    g_printerr (&quot;Usage: %s &lt;Ogg/Vorbis filename&gt;\n&quot;, argv[0]);<br>    return -1;<br>  }<br><br><br>  /* Create gstreamer elements */<br>  pipeline = gst_pipeline_new (&quot;audio-player&quot;);<br>
  source   = gst_element_factory_make (&quot;filesrc&quot;,       &quot;file-source&quot;);<br>  demuxer  = gst_element_factory_make (&quot;oggdemux&quot;,      &quot;ogg-demuxer&quot;);<br>  decoder  = gst_element_factory_make (&quot;vorbisdec&quot;,     &quot;vorbis-decoder&quot;);<br>
  conv     = gst_element_factory_make (&quot;audioconvert&quot;,  &quot;converter&quot;);<br>  sink     = gst_element_factory_make (&quot;autoaudiosink&quot;, &quot;audio-output&quot;);<br><br>  if (!pipeline || !source || !demuxer || !decoder || !conv || !sink) {<br>
    g_printerr (&quot;One element could not be created. Exiting.\n&quot;);<br>    return -1;<br>  }<br><br>  /* Set up the pipeline */<br><br>  /* we set the input filename to the source element */<br>  g_object_set (G_OBJECT (source), &quot;location&quot;, argv[1], NULL);<br>
<br>  /* we add a message handler */<br>  bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));<br>  gst_bus_add_watch (bus, bus_call, loop);<br>  gst_object_unref (bus);<br><br>  /* we add all elements into the pipeline */<br>
  /* file-source | ogg-demuxer | vorbis-decoder | converter | alsa-output */<br>  gst_bin_add_many (GST_BIN (pipeline),<br>                    source, demuxer, decoder, conv, sink, NULL);<br><br>  /* we link the elements together */<br>
  /* file-source -&gt; ogg-demuxer ~&gt; vorbis-decoder -&gt; converter -&gt; alsa-output */<br>  gst_element_link (source, demuxer);<br>  gst_element_link_many (decoder, conv, sink, NULL);<br>  g_signal_connect (demuxer, &quot;pad-added&quot;, G_CALLBACK (on_pad_added), decoder);<br>
<br>  /* note that the demuxer will be linked to the decoder dynamically.<br>     The reason is that Ogg may contain various streams (for example<br>     audio and video). The source pad(s) will be created at run time,<br>
     by the demuxer when it detects the amount and nature of streams.<br>     Therefore we connect a callback function which will be executed<br>     when the &quot;pad-added&quot; is emitted.*/<br><br><br>  /* Set the pipeline to &quot;playing&quot; state*/<br>
  g_print (&quot;Now playing: %s\n&quot;, argv[1]);<br>  gst_element_set_state (pipeline, GST_STATE_PLAYING);<br><br><br>  /* Iterate */<br>  g_print (&quot;Running...\n&quot;);<br>  g_main_loop_run (loop);<br><br><br>  /* Out of the main loop, clean up nicely */<br>
  g_print (&quot;Returned, stopping playback\n&quot;);<br>  gst_element_set_state (pipeline, GST_STATE_NULL);<br><br>  g_print (&quot;Deleting pipeline\n&quot;);<br>  gst_object_unref (GST_OBJECT (pipeline));<br><br>  return 0;<br>
}<br><br><br>Tks so much!<br>