[GRASS-dev] Error in previous declaration when compiling

rabotin rabotin at supagro.inra.fr
Thu Aug 25 06:28:50 EDT 2011


Dear All,
Using GRASS to develop shell and perl script during few years, I try to 
develop now my own scripts in C and C++ and using the grass library.

We are using an modelisation platform environment (where my scripts will 
be implemented) which use the libglibmm library (on ubuntu 64 bits).

When I try this liitle script in C++:

#include <module.h>

extern "C" {
#include <stdio.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/Vect.h>
#include <grass/dbmi.h>
#include <grass/glocale.h>

}

int main()
{

return 0;
}

Where module.h is a header file of the libglibmm library, GCC returns 
the following errors with the following command:

gcc -c main.cpp -I/usr/lib/grass64/include/ -I/usr/include/gdal 
-I/usr/include/glibmm-2.4/glibmm/

In file included from main.cpp:14:0:
/usr/lib/grass64/include/grass/gis.h:623:8: error: using typedef-name 
‘GModule’ after ‘struct’
/usr/include/glibmm-2.4/glibmm/module.h:30:38: error: ‘GModule’ has a 
previous declaration here
In file included from /usr/lib/grass64/include/grass/gis.h:645:0,
from main.cpp:14:
/usr/lib/grass64/include/grass/gisdefs.h:886:8: error: using 
typedef-name ‘GModule’ after ‘struct’
/usr/include/glibmm-2.4/glibmm/module.h:30:38: error: ‘GModule’ has a 
previous declaration here
/usr/lib/grass64/include/grass/gisdefs.h:886:38: error: invalid type in 
declaration before ‘;’ token


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. Does anyone meet the same issues when using 
independant library with grass libraries ?

Thanks for any help

Michael Rabotin



-- 
*********************************

Michaël Rabotin
Ingénieur d'étude en géomatique / GIS Engineer

Laboratoire d'étude des Interactions Sol, Agrosystème et Hydrosystème

UMR LISAH Montpellier SupAgro-INRA-IRD
Bat. 24
2 place Viala
34060 Montpellier cedex 1
FRANCE

Laboratory Interactions between Soils, Agrosystems and Hydrosystems (LISAH)
Multi-Institute Research Unit (UMR)
French National Institute for Agricultural Research (INRA)
French Institute for Research and Overseas Development (IRD)
International Center for Higher Education in Agricultural Sciences (Montpellier SupAgro)

Téléphone / Phone number :  33 (0)4 99 61 23 85
Secrétariat / Secretariat : 33 (0)4 99 61 22 61
Fax : 33 (0)4 67 63 26 14
E-mail : rabotin at supagro.inra.fr
Site web / website: http://www.umr-lisah.fr/
Site web OpenFLUID / OpenFLUID website: http://www.umr-lisah.fr/openfluid/
*********************************








More information about the grass-dev mailing list