[GRASS-dev] oproj void** invalid conversion

Hi,
I am trying to convert Coordinates to lat / long. I would like to save the output projection parameters in oproj.

But the compiler is complaining.

error: invalid conversion from ‘void*’ to ‘void**’.

If I use *oproj.pj instead of oproj.pj the compiler doesn't complain anymore but the transformation to lat / long does not work.

The code is following below.

Does anybody know this problem. I used this code a couple of months ago and it worked.

Thanks

Andi

struct Key_Value *in_proj_info, *in_unit_info; /* projection information of input map */
struct pj_info iproj; /* input map proj parameters */
struct pj_info oproj; /* output map proj parameters */

/* read current projection info */
if ((in_proj_info = G_get_projinfo()) == NULL)
G_fatal_error("Can't get projection info of current location");

if ((in_unit_info = G_get_projunits()) == NULL)
G_fatal_error("Can't get projection units of current location");

if (pj_get_kv(&iproj, in_proj_info, in_unit_info) < 0)
G_fatal_error("Can't get projection key values of current location");

G_free_key_value( in_proj_info );
G_free_key_value( in_unit_info );

oproj.zone = 0;
oproj.meters = 1.;
sprintf(oproj.proj, "ll");
if ((oproj.pj = pj_latlong_from_proj(iproj.pj)) == NULL)
G_fatal_error("Unable to set up lat/long projection parameters");

Andreas Jochem wrote:

I am trying to convert Coordinates to lat / long. I would like to save
the output projection parameters in oproj.

But the compiler is complaining.

error: invalid conversion from �void*� to �void**�.

If I use *oproj.pj instead of oproj.pj the compiler doesn't complain
anymore but the transformation to lat / long does not work.

The code is following below.

Does anybody know this problem. I used this code a couple of months ago
and it worked.

The type of the "pj" field of "struct pj_info" was wrong (projPJ is a
typedef for "void *").

It was corrected in r33949 (7.0) and r33951 (6.4):

  http://trac.osgeo.org/grass/changeset/33949

  http://trac.osgeo.org/grass/changeset/33951

if ((oproj.pj = pj_latlong_from_proj(iproj.pj)) == NULL)
  G_fatal_error("Unable to set up lat/long projection parameters");

This code is correct. If it generates a warning, your
<grass/gprojects.h> file is out of date. It should still work, though.

Using *oproj.pj will never work.

--
Glynn Clements <glynn@gclements.plus.com>