Hi Cedric. It is common to accept little code duplication and just write
in ConfigUI.h: extern PrettyPrintingOptions* prettyPrintingOptions; in ConfigUI.c: #include "ConfigUi.h" PrettyPrintingOptions* prettyPrintingOptions; This way is more straightforward and obvious. On Sat, 12 Sep 2009 10:54:51 +0200 Cédric Tabin <[email protected]> wrote: > Hi Eugene, > > Thanks for your explanations :-) That's important to me to > understand how it works ! > Can you tell me if it is the good way to solve this like that : > > in ConfigUI.h > > #ifndef PP_CONFIG_UI_PPOPTIONS > extern > #endif > > PrettyPrintingOptions* prettyPrintingOptions; > > > in ConfigUI.c > > #define PP_CONFIG_UI_PPOPTIONS > #include "ConfigUI.h" > > Seems to work on my computer ! > > Regards, > Cedric > > On Sat, Sep 12, 2009 at 10:45 AM, Eugene Arshinov > <[email protected]>wrote: > > > Hi. > > > > No, that was me who missed something... I did not check whether the > > changes I suggested work... > > > > So, let me explain a bit how to use extern. Declaration using > > extern if only _declaration_, not definition. Extern says that you > > define prettyPrintingOptions somewhere within your plugin and let > > *.c files which include ConfigUI.h to discover that. But, you must > > actually _define_ prettyPluginOptions in any *.c file. > > > > The error I discovered was that _two_ *.c files included > > _definition_ of prettyPrintingOptions, so linker reported that it > > was defined twice. Without -fno-common linker discoveres double > > definition and leave only one of those. This behavior is > > non-standard, so I recommend using -fno-common. > > > > Summary: > > - put extern where I suggested > > - additionally, put original definition (without extern) in > > PluginEntry.c (or another source file) > > > > Sorry for inconvenience, and long answer... > > > > On Sat, 12 Sep 2009 10:21:20 +0200 > > Cédric Tabin <[email protected]> wrote: > > > > > Hello, > > > > > > If I put 'extern' in ConfigUI.h, geany cannot load my plugin : > > > > > > Can't load plugin: /usr/local/lib/geany/pretty-print.so: undefined > > > symbol: prettyPrintingOptions > > > > > > Do I miss something somewhere ? > > > > > > Regards, > > > Cedric > > > > > > On Sat, Sep 12, 2009 at 10:04 AM, Eugene Arshinov > > > <[email protected]>wrote: > > > > > > > Hi. > > > > > > > > Just declare prettyPrintingOptions as extern in ConfigUI.h: > > > > > > > > extern PrettyPrintingOptions* prettyPrintingOptions; > > > > > > > > The error is caused by -fno-common GCC option which is in my > > > > CFLAGS. Usually, in header files you should declare all > > > > variables as extern. > > > > > > > > Best regards, > > > > Eugene. > > > > > > > > On Sat, 12 Sep 2009 09:48:33 +0200 > > > > Cédric Tabin <[email protected]> wrote: > > > > > > > > > Hello, > > > > > > > > > > Strange... I tried again and again on my gentoo and it > > > > > compiles well. Does anyone have that kind of problem ? Maybe > > > > > my headers are wrong (I use the variable prettyPrinterOptions > > > > > into PluginEntry.c that is defined into ConfigUI.h). I a boss > > > > > of C can just take a lool :-) > > > > > > > > > > Regards, > > > > > Cedric > > > > > > > > > > On Sat, Sep 12, 2009 at 8:54 AM, Eugene Arshinov > > > > > <[email protected]>wrote: > > > > > > > > > > > Hi all. > > > > > > > > > > > > I can't compile geany-plugins since r918 ("Pretty-print : > > > > > > Doctype supporte added, bugfix on cdata processing") with > > > > > > latest geany (r4176). > > > > > > > > > > > > I installed geany with > > > > > > > > > > > > $ make uninstall && make clean && ./autogen.sh && make && > > > > > > sudo make install > > > > > > > > > > > > and was trying to build geany-plugins > > > > > > > > > > > > $ aclocal && ./autogen.sh && make > > > > > > > > > > > > but it failed: > > > > > > > > > > > > ... > > > > > > libtool: link: gcc > > > > > > -shared .libs/pretty_print_la-PluginEntry.o > > > > > > .libs/pretty_print_la-PrettyPrinter.o > > .libs/pretty_print_la-ConfigUI.o > > > > > > -L/usr/local/lib /usr/lib/libgtk-x11-2.0.so /usr/lib/ > > > > libgdk-x11-2.0.so/usr/lib/ > > > > > > libatk-1.0.so /usr/lib/ > > libpangoft2-1.0.so/usr/lib/libgdk_pixbuf-2.0.so-lm /usr/lib/ > > > > > > libpangocairo-1.0.so /usr/lib/libgio-2.0.so /usr/lib/libcairo.so > > > > /usr/lib/ > > > > > > libpango-1.0.so /usr/lib/libfreetype.so -lz > > > > > > -lfontconfig /usr/lib/ > > > > > > libgobject-2.0.so /usr/lib/libgmodule-2.0.so /usr/lib/ > > > > libglib-2.0.so/usr/lib/libxml2.so > > > > > > -march=pentium4 -Wl,-soname -Wl,pretty-print.so > > > > > > -o .libs/pretty-print.so > > .libs/pretty_print_la-ConfigUI.o:(.bss+0x0): > > > > > > multiple definition of `prettyPrintingOptions' > > > > > > .libs/pretty_print_la-PluginEntry.o:(.bss+0x0): first > > > > > > defined here ... > > > > > > > > > > > > Can anyone reproduce it? > > > > > > > > > > > > Best regards, > > > > > > Eugene. > > > > > > _______________________________________________ > > > > > > Geany-devel mailing list > > > > > > [email protected] > > > > > > http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel > > > > > > > > > > _______________________________________________ > > > > Geany-devel mailing list > > > > [email protected] > > > > http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel > > > > > > _______________________________________________ > > Geany-devel mailing list > > [email protected] > > http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel > > _______________________________________________ Geany-devel mailing list [email protected] http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
