[Proj] PROJ 4.8.0, projects.h and projPJ struct
José Luis García Pallero
jgpallero at gmail.com
Wed Apr 11 03:30:45 PDT 2012
Hello:
As it is said in NEWS files from PROJ 4.8.0 now proj_api.h file should
be included in programs instead projects.h. I've tried to compile my
old code (that has no problems with 4.7.0) and I've obtained a warning
and an error.
In my code I have a declaration like
projPJ proyec;
and I use them later as
proyec = pj_init_plus(param);
and more later, in order to check if a projections has inverse step:
if(proyec->inv==0)
{
......
}
If I compile the program using 4.8.0 version I obtain a warning and an error:
geocproj.c:202:14: warning: dereferencing ‘void *’ pointer [enabled by
default]
geocproj.c:202:14: error: request for member ‘inv’ in something not a
structure or union
Looking proj_api.h file, in both versions 4.7.0 and 4.8.0 I can see the block
for 4.7.0
#if !defined(PROJECTS_H)
typedef struct { double u, v; } projUV;
typedef void *projPJ;
#define projXY projUV
#define projLP projUV
#else
typedef PJ *projPJ;
# define projXY XY
# define projLP LP
#endif
for 4.8.0
#if !defined(PROJECTS_H)
typedef struct { double u, v; } projUV;
typedef void *projPJ;
#define projXY projUV
#define projLP projUV
typedef void *projCtx;
#else
typedef PJ *projPJ;
typedef projCtx_t *projCtx;
# define projXY XY
# define projLP LP
#endif
Both are the same (except for the ctx context). In both if PROJECTS_H
is not defined (i.e. if projects.h was not included) the type projPJ
is defined as void* instead PJ*. PJ is defined in projects.h. But in
the include/ folder of 4.8.0 project.h was not copied, so it's
impossible to use it. So I can't use the 'inv' field and I suppone no
PJ struct at all as projPJ was defined as void*. Then which is the
correct way in order to use the new PROJ 4.8.0 version?
On the other hand, suppose that 4.8.0 works well in my case only
including proj_api.h. Then my problem is that if I have not knowledge
about the version of PROJ in one computer, how can I proceed in order
to use the correct include depending versions.
First of all, can I use version 4.7.0 (for example) with only
#include<proj_api.h>? In my case the answer is NO because I obtain the
same warning and error that in 4.8.0. Then I try:
#include<proj_api.h>
#if PJ_VERSION<480
#include<projects.h>
#endif
PJ_VERSION is defined in proj_api.h. I check if version is older than
4.8.0 and try to include then projects.h. But I obtain some errors:
/usr/include/projects.h:139:33: error: conflicting types for ‘projUV’
/usr/include/proj_api.h:54:37: note: previous declaration of ‘projUV’
was here
geocproj.c: In function ‘ProjFwd’:
geocproj.c:120:9: error: incompatible type for argument 1 of ‘pj_fwd’
/usr/include/proj_api.h:66:8: note: expected ‘projUV’ but argument is
of type ‘projUV’
geocproj.c: In function ‘ProjInv’:
geocproj.c:202:14: warning: dereferencing ‘void *’ pointer [enabled by
default]
geocproj.c:202:14: error: request for member ‘inv’ in something not a
structure or union
geocproj.c:223:9: error: incompatible type for argument 1 of ‘pj_inv’
/usr/include/proj_api.h:67:8: note: expected ‘projUV’ but argument is
of type ‘projUV’
We can see conflicting type errors due to definitions of projUV in
proj_api.h and projects.h.
Opinions about?
Cheers
--
*****************************************
José Luis García Pallero
jgpallero at gmail.com
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************
More information about the Proj
mailing list