[GRASS-dev] Error in previous declaration when compiling
Glynn Clements
glynn at gclements.plus.com
Thu Aug 25 11:49:54 EDT 2011
rabotin wrote:
> It seems that grass/gis.h and the libgilbmm librarys declare a structure
> with the same name: GModule.
> As I am steel a newbie in C and C++ developments, I don't really know
> how to solve this problem.
It might work to use e.g.:
#define GModule GRASS_GModule
#include <grass/gis.h>
#include <grass/Vect.h>
#include <grass/dbmi.h>
#include <grass/glocale.h>
#undef GModule
You'll need to use GRASS_GModule when declaring the variable to hold
the pointer returned from G_define_module().
Note that you can't do it the other way around (change the name used
by glibmm) because type names are embedded in external symbols which
have C++ linkage.
I was going to suggest that gtkmm should be using C++ namespaces, but
it already does; GModule comes from glib itself.
I'm guessing that GRASS uses GModule because Module caused a conflict
sometime in the past (Flag and Option aren't called GFlag or GOption).
The "G" prefix is a bit unfortunate really, given how many libraries
use it (usually from GNU; e.g. GNU Image Manipulation Program (GIMP)
-> GIMP ToolKit (GTK) -> gtk/gdk/glib -> gtkmm/glibmm).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list