title: Error compiling BASIC "libnotify" code
body: <pre><code>#include &lt;libnotify/notify.h&gt;
  #include &lt;glib.h&gt;
  #include &lt;unistd.h&gt;
  int main(int argc, char** argv)
  {
      if(argc == 3)
      {
          NotifyNotification *n;
          notify_init("Test");
          n = notify_notification_new (argv[1],argv[2], NULL, NULL);
          notify_notification_set_timeout (n, 3000); //3 seconds
          if (!notify_notification_show (n, NULL)) {
              g_error("Failed to send notification.\n");
              return 1;
          }
          g_object_unref(G_OBJECT(n));
      }else{
          g_print("Too few arguments (%d), 2 needed.\n", argc-1);
      }
      return 0;
  }
  </code></pre>
  
  <p>Compiling the code gives me <strong>"undefined reference to"</strong> error:</p>
  
  <pre><code>shadyabhi@shadyabhi-desktop:~/c$ gcc -Wall -o test libnotify.c `pkg-config --libs --cflags glib-2.0 gtk+-2.0`
  /tmp/ccA2Q6xX.o: In function `main':
  libnotify.c:(.text+0x20): undefined reference to `notify_init'
  libnotify.c:(.text+0x4b): undefined reference to `notify_notification_new'
  libnotify.c:(.text+0x60): undefined reference to `notify_notification_set_timeout'
  libnotify.c:(.text+0x71): undefined reference to `notify_notification_show'
  collect2: ld returned 1 exit status
  shadyabhi@shadyabhi-desktop:~/c$
  </code></pre>
  
  <p>I took the code from this <a href="http://ubublogger.wordpress.com/2009/04/04/using-ubuntu-jauntys-new-notification-system-notify-osd/" rel="nofollow noreferrer">blog</a>.</p>