title: Compiling XFCE4 panel plugin
body: <p>I am converting a gnome panel applet to xfce panel plugin. I have so far removed the few gnome specific parts in the source and replaced them with xfce specific source as appropriate.</p>
  <p>I created makefile.am and configure.ac files using templates such as the weather plugin and the example plugin. However I am unsuccessful in getting it compiled properly. I am probably missing something obvious, but I double checked the examples with my own files and found no obvious problems.</p>
  <p>I have attached the appropriate files as well as output of the errors in the hope someone has an idea. I don't think the problem is in the actual source, but I can add some of that later if necessary.</p>
  <p>Errors while compiling:</p>
  <pre><code>make  all-recursive
  make[1]: Entering directory `/source/my_example_xfce'
  Making all in panel-plugin
  make[2]: Entering directory `/source/my_example_xfce/panel-plugin'
  gcc -DHAVE_CONFIG_H -I. -I.. -I.. -DTHEMESDIR=\&quot;/usr/local/share/xfce4/my_example/icons\&quot; -DPACKAGE_LOCALE_DIR=\&quot;/usr/local/share/locale\&quot; -DG_LOG_DOMAIN=\&quot;my_example\&quot; -DNDEBUG -pthread -I/usr/include/xfce4/libxfce4panel-1.0 -I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/xfce4   -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/atk-1.0 -I/usr/include/xfce4   -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/xfce4 -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12                                                         -g -O2 -MT xfce4_my_example_plugin-my_example.o -MD -MP -MF .deps/xfce4_my_example_plugin-my_example.Tpo -c -o xfce4_my_example_plugin-my_example.o `test -f 'my_example.c' || echo './'`my_example.c
  
  my_example.c:25:25: warning: ‘struct Example_Data’ declared inside parameter list [enabled by default]
  my_example.c:25:25: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
  my_example.c: In function ‘setdefaults’:
  my_example.c:28:3: warning: incompatible implicit declaration of built-in function ‘strncpy’ [enabled by default]
  my_example.c:28:21: error: dereferencing pointer to incomplete type
  my_example.c:28:45: warning: incompatible implicit declaration of built-in function ‘strlen’ [enabled by default]
  my_example.c:28:3: warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast [enabled by default]
  my_example.c:28:3: note: expected ‘const char *’ but argument is of type ‘int’
  my_example.c:28:3: warning: passing argument 2 of ‘strncpy’ makes pointer from integer without a cast [enabled by default]
  my_example.c:28:3: note: expected ‘const char *’ but argument is of type ‘int’
  my_example.c:30:21: error: dereferencing pointer to incomplete type
  my_example.c:30:42: error: dereferencing pointer to incomplete type
  my_example.c:30:67: error: dereferencing pointer to incomplete type
  my_example.c:31:3: warning: incompatible implicit declaration of built-in function ‘strncat’ [enabled by default]
  my_example.c:31:21: error: dereferencing pointer to incomplete type
  my_example.c:31:32: error: ‘SIGFILE’ undeclared (first use in this function)
  </code></pre>
  <p>SIGFILE is one of the defines in my header files. Then it goes on as if it never read my header files with all the declarations.</p>
  <p>Last bit:</p>
  <pre><code>my_example.c:248:17: error: unknown type name ‘XfcePanelPlugin’
  my_example.c:248:42: error: unknown type name ‘GtkWidget’
  my_example.c:248:60: error: unknown type name ‘GtkWidget’
  make[2]: *** [xfce4_my_example_plugin-example.o] Error 1
  make[2]: Leaving directory `/source/my_example_xfce/panel-plugin'
  make[1]: *** [all-recursive] Error 1
  make[1]: Leaving directory `/source/my_example_xfce'
  make: *** [all] Error 2 
  </code></pre>
  <p>Below I pasted Makefile.am, configure.ac and panel-plugin/Makefile.am which are required for xfce4 xdt-autogen tool, which when run in the source directory will generate the appropriate make and configure files.</p>
  <pre><code>***************
  * Makefile.am *
  ***************
  
  SUBDIRS =                                                               \
          panel-plugin                                                            \
          po
  
  AUTOMAKE_OPTIONS =                                                      \
          1.8                                                             \
          dist-bzip2
  
  
  *****************
  * configure.ac  *
  *****************
  
  dnl Version information
  m4_define([my_example_version_major], [1])
  m4_define([my_example_version_minor], [3])
  m4_define([my_example_version_micro], [0])
  m4_define([my_example_version], [my_example_version_major().my_example_version_minor().my_example_version_micro()])
  
  dnl Initialize autoconf
  AC_COPYRIGHT([Copyright (c) 2013
          Example &lt;bug@example.org&gt;])
  AC_INIT([xfce4-my_example-plugin], [my_example_version()], [bug@example.org])
  AC_PREREQ([2.50])
  
  dnl Initialize automake
  AM_INIT_AUTOMAKE([1.8 dist-bzip2 tar-ustar])
  AM_CONFIG_HEADER([config.h])
  AM_MAINTAINER_MODE()
  
  dnl Check for basic programs
  AC_PROG_CC()
  AC_PROG_LD()
  AC_PROG_INSTALL()
  AC_PROG_INTLTOOL()
  AC_PROG_LIBTOOL()
  AM_PROG_CC_C_O()
  
  dnl Check for standard headers
  AC_HEADER_STDC()
  AC_CHECK_HEADERS([string.h fcntl.h errno.h sys/socket.h netdb.h \
                    netinet/in.h sys/types.h time.h unistd.h stdio.h \
                    sys/stat.h stddef.h stdlib.h netinet/in.h])
  
  dnl Check for i18n support
  XDT_I18N([])
  
  dnl Check for required packages
  XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.6.0])
  XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.6.0])
  XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.3.90.2])
  XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.3.90.2])
  XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.99.1])
  
  dnl Check for debugging support
  XDT_FEATURE_DEBUG()
  
  AC_OUTPUT([
  Makefile
  po/Makefile.in
  panel-plugin/Makefile
  ])
  
  
  ****************************
  * panel-plugin/Makefile.am *
  ****************************
  
  INCLUDES =                                                              \
          -I$(top_srcdir)                                                 \
          -DTHEMESDIR=\&quot;$(datadir)/xfce4/my_example/icons\&quot;                       \
          -DPACKAGE_LOCALE_DIR=\&quot;$(localedir)\&quot;                           \
          -DG_LOG_DOMAIN=\&quot;my_example\&quot;
  plugin_PROGRAMS =                                                       \
          xfce4-my_example-plugin
  
  plugindir = $(libexecdir)/xfce4/panel-plugins
  
  xfce4_my_example_plugin_SOURCES =                                               \
          my_example_dat.h                                                    \
          my_example_func.h                                                   \
          my_example_images.h                                                     \
          my_example_applet.c                                                     \
          my_example.c                                                            \
          my_example_processdata.c                                                \
          my_example_menu.c
  
  xfce4_my_example_plugin_CFLAGS =                                                \
          $(LIBXFCE4PANEL_CFLAGS)                                         \
          $(LIBXFCEGUI4_CFLAGS)                                           \
          $(LIBXFCE4UTIL_CFLAGS)                                          \
          $(GTK_CFLAGS)
  
  xfce4_my_example_plugin_LDADD =                                                 \
          $(LIBXFCE4PANEL_LIBS)                                           \
          $(LIBXFCE4UTIL_LIBS)                                            \
          $(LIBXFCEGUI4_LIBS)                                             \
          $(GTK_LIBS)
  
  desktopdir = $(datadir)/xfce4/panel-plugins
  
  desktop_DATA =                                                          \
          my_example.desktop
  
  @INTLTOOL_DESKTOP_RULE@
  
  EXTRA_DIST =                                                            \
          my_example.desktop.in
  
  CLEANFILES =                                                            \
          $(desktop_DATA)
  
  # vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
  </code></pre>
  <p>I do have the right header files included in my source files in addition the source files compile fine before making the xfce4 related changes.</p>
  <p>Makefile.am</p>
  <pre><code>xfce4_my_example_plugin_SOURCES =     \
  example_dat.h                                                    \
  example_func.h                                                   \
  example_images.h                                                 \
  example_applet.c                                                 \
  example.c                                                        \
  example_processdata.c                                            \
  example_menu.c
  </code></pre>
  <p>From example_applet.c which is the first source file entered. Originally I only had &quot;xfce4_my_example_plugin_SOURCES = example_applet.c&quot; since the rest would be found through that file. It gave the same error.</p>
  <pre><code>#include &lt;gtk/gtk.h&gt;
  #include &lt;glib-object.h&gt;
  #include &lt;string.h&gt;
  #include &lt;libxfce4util/libxfce4util.h&gt;
  #include &lt;libxfce4panel/xfce-panel-plugin.h&gt;
  #include &lt;libxfce4panel/xfce-hvbox.h&gt;
  
  #include &quot;example_dat.h&quot; /* contains all structures */
  #include &quot;example_func.h&quot; /* contains all function prototypes used in this program */
  #include &quot;example_images.h&quot;
  #include &quot;example.c&quot;
  #include &quot;example_processdata.c&quot;
  #include &quot;example_menu.c&quot;
  
  
  /* register the xfce plugin */
  XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL(example_applet_fill);
  </code></pre>