Hi Eugene,<br><br>Thanks for your explanations :-) That's important to me to understand  how it works !<br>Can you tell me if it is the good way to solve this like that :<br><br>in ConfigUI.h<br><br><span style="font-family: courier new,monospace;">#ifndef PP_CONFIG_UI_PPOPTIONS</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    extern</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#endif</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">PrettyPrintingOptions* prettyPrintingOptions;</span><br><br><br>in ConfigUI.c<br><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#define PP_CONFIG_UI_PPOPTIONS </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#include "ConfigUI.h"</span><br>
<br>Seems to work on my computer !<br><br>Regards,<br>Cedric<br><br><div class="gmail_quote">On Sat, Sep 12, 2009 at 10:45 AM, Eugene Arshinov <span dir="ltr"><<a href="mailto:earshinov@gmail.com">earshinov@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi.<br>
<br>
No, that was me who missed something... I did not check whether the<br>
changes I suggested work...<br>
<br>
So, let me explain a bit how to use extern. Declaration using extern if<br>
only _declaration_, not definition. Extern says that you define<br>
prettyPrintingOptions somewhere within your plugin and let *.c files<br>
which include ConfigUI.h to discover that. But, you must actually<br>
_define_ prettyPluginOptions in any *.c file.<br>
<br>
The error I discovered was that _two_ *.c files included _definition_ of<br>
prettyPrintingOptions, so linker reported that it was defined twice.<br>
Without -fno-common linker discoveres double definition and leave<br>
only one of those. This behavior is non-standard, so I recommend<br>
using -fno-common.<br>
<br>
Summary:<br>
  - put extern where I suggested<br>
  - additionally, put original definition (without extern) in<br>
    PluginEntry.c (or another source file)<br>
<br>
Sorry for inconvenience, and long answer...<br>
<br>
On Sat, 12 Sep 2009 10:21:20 +0200<br>
<div><div></div><div class="h5">Cédric Tabin <<a href="mailto:tabin.cedric@gmail.com">tabin.cedric@gmail.com</a>> wrote:<br>
<br>
> Hello,<br>
><br>
> If I put 'extern' in ConfigUI.h, geany cannot load my plugin :<br>
><br>
> Can't load plugin: /usr/local/lib/geany/pretty-print.so: undefined<br>
> symbol: prettyPrintingOptions<br>
><br>
> Do I miss something somewhere ?<br>
><br>
> Regards,<br>
> Cedric<br>
><br>
> On Sat, Sep 12, 2009 at 10:04 AM, Eugene Arshinov<br>
> <<a href="mailto:earshinov@gmail.com">earshinov@gmail.com</a>>wrote:<br>
><br>
> > Hi.<br>
> ><br>
> > Just declare prettyPrintingOptions as extern in ConfigUI.h:<br>
> ><br>
> >  extern PrettyPrintingOptions* prettyPrintingOptions;<br>
> ><br>
> > The error is caused by -fno-common GCC option which is in my CFLAGS.<br>
> > Usually, in header files you should declare all variables as extern.<br>
> ><br>
> > Best regards,<br>
> > Eugene.<br>
> ><br>
> > On Sat, 12 Sep 2009 09:48:33 +0200<br>
> > Cédric Tabin <<a href="mailto:tabin.cedric@gmail.com">tabin.cedric@gmail.com</a>> wrote:<br>
> ><br>
> > > Hello,<br>
> > ><br>
> > > Strange... I tried again and again on my gentoo and it compiles<br>
> > > well. Does anyone have that kind of problem ? Maybe my headers<br>
> > > are wrong (I use the variable prettyPrinterOptions into<br>
> > > PluginEntry.c that is defined into ConfigUI.h). I a boss of C can<br>
> > > just take a lool :-)<br>
> > ><br>
> > > Regards,<br>
> > > Cedric<br>
> > ><br>
> > > On Sat, Sep 12, 2009 at 8:54 AM, Eugene Arshinov<br>
> > > <<a href="mailto:earshinov@gmail.com">earshinov@gmail.com</a>>wrote:<br>
> > ><br>
> > > > Hi all.<br>
> > > ><br>
> > > > I can't compile geany-plugins since r918 ("Pretty-print :<br>
> > > > Doctype supporte added, bugfix on cdata processing") with<br>
> > > > latest geany (r4176).<br>
> > > ><br>
> > > > I installed geany with<br>
> > > ><br>
> > > > $ make uninstall && make clean && ./autogen.sh && make && sudo<br>
> > > > make install<br>
> > > ><br>
> > > > and was trying to build geany-plugins<br>
> > > ><br>
> > > > $ aclocal && ./autogen.sh && make<br>
> > > ><br>
> > > > but it failed:<br>
> > > ><br>
> > > > ...<br>
> > > > libtool: link: gcc -shared  .libs/pretty_print_la-PluginEntry.o<br>
> > > > .libs/pretty_print_la-PrettyPrinter.o .libs/pretty_print_la-ConfigUI.o<br>
> > > > -L/usr/local/lib /usr/lib/<a href="http://libgtk-x11-2.0.so" target="_blank">libgtk-x11-2.0.so</a> /usr/lib/<br>
> > <a href="http://libgdk-x11-2.0.so/usr/lib/" target="_blank">libgdk-x11-2.0.so/usr/lib/</a><br>
> > > > <a href="http://libatk-1.0.so" target="_blank">libatk-1.0.so</a> /usr/lib/<a href="http://libpangoft2-1.0.so/usr/lib/libgdk_pixbuf-2.0.so-lm" target="_blank">libpangoft2-1.0.so/usr/lib/libgdk_pixbuf-2.0.so-lm</a> /usr/lib/<br>

> > > > <a href="http://libpangocairo-1.0.so" target="_blank">libpangocairo-1.0.so</a> /usr/lib/<a href="http://libgio-2.0.so" target="_blank">libgio-2.0.so</a> /usr/lib/libcairo.so<br>
> > /usr/lib/<br>
> > > > <a href="http://libpango-1.0.so" target="_blank">libpango-1.0.so</a> /usr/lib/libfreetype.so -lz<br>
> > > > -lfontconfig /usr/lib/<br>
> > > > <a href="http://libgobject-2.0.so" target="_blank">libgobject-2.0.so</a> /usr/lib/<a href="http://libgmodule-2.0.so" target="_blank">libgmodule-2.0.so</a> /usr/lib/<br>
> > <a href="http://libglib-2.0.so/usr/lib/libxml2.so" target="_blank">libglib-2.0.so/usr/lib/libxml2.so</a><br>
> > > > -march=pentium4   -Wl,-soname -Wl,pretty-print.so<br>
> > > > -o .libs/pretty-print.so .libs/pretty_print_la-ConfigUI.o:(.bss+0x0):<br>
> > > > multiple definition of `prettyPrintingOptions'<br>
> > > > .libs/pretty_print_la-PluginEntry.o:(.bss+0x0): first defined<br>
> > > > here ...<br>
> > > ><br>
> > > > Can anyone reproduce it?<br>
> > > ><br>
> > > > Best regards,<br>
> > > > Eugene.<br>
> > > > _______________________________________________<br>
> > > > Geany-devel mailing list<br>
> > > > <a href="mailto:Geany-devel@uvena.de">Geany-devel@uvena.de</a><br>
> > > > <a href="http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel" target="_blank">http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel</a><br>
> > > ><br>
> > _______________________________________________<br>
> > Geany-devel mailing list<br>
> > <a href="mailto:Geany-devel@uvena.de">Geany-devel@uvena.de</a><br>
> > <a href="http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel" target="_blank">http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel</a><br>
> ><br>
_______________________________________________<br>
Geany-devel mailing list<br>
<a href="mailto:Geany-devel@uvena.de">Geany-devel@uvena.de</a><br>
<a href="http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel" target="_blank">http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel</a><br>
</div></div></blockquote></div><br>