[GRASS5] G3D-api error

Glynn Clements glynn.clements at virgin.net
Wed Sep 3 01:28:26 EDT 2003


N.J. Hardebol wrote:

> I'm writing a geophysical routine and I'd like to store a 3D temperature
> field as G3D raster.
> In the past I encountered some problems to find all the includes and lib -
> this is properly solved.
> I'm using Grass5.0.2 under Suse Linux 8.2
> 
> but,
> 
> I'm not succeeding in writing my data to a g3d file.
> I'm using the following functions (and some more..):
> G3d_openCellNew (char *name, int type, int cache, G3D_Region *region); that
> returns a void* which is a pointer to the newly created g3d-raster - Am I
> right?
> 
> G3d_putValue (void *map, int x, int y, int z, char *value, int type); where
> void *map revers to the opened g3d-raster
> 
> my g++ compiler tells me that *map should be of type G3D_Map instead of
> void*.
> 
> checking the grass5.0.2/src/include/G3d.h confirms this with the following
> function declaration:
> int G3d_putValue(G3D_Map *, int, int, int, char *, int);
> 
> What am I doing wrong? - Or do some inconsistencies exist in the g3d-api?

GRASS (including G3D) is written in (and written for) C, not C++. In
C, it's legal to implictly cast between void* and other pointers. In
C++, you have to use an explicit cast, e.g.

	map = (G3D_Map *) G3d_openCellNew(...);

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list