[GRASS-dev] Compilation error on grass7-svn

Hi list,

I got the following error when compiling against the last update of
the grass7 trunk:

gcc -g -fPIC
-I/usr/local/src/grass_trunk/dist.x86_64-unknown-linux-gnu/include
-I/usr/local/src/grass_trunk/dist.x86_64-unknown-linux-gnu/include
-D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grasslibs"\"
-I/usr/local/src/grass_trunk/dist.x86_64-unknown-linux-gnu/include
-I/usr/local/src/grass_trunk/dist.x86_64-unknown-linux-gnu/include -o
OBJ.x86_64-unknown-linux-gnu/strings.o -c strings.c
strings.c:136: error: conflicting types for ‘G_str_replace’
/usr/local/src/grass_trunk/dist.x86_64-unknown-linux-gnu/include/grass/gisdefs.h:580:
note: previous declaration of ‘G_str_replace’ was here
strings.c: In function ‘G_str_replace’:
strings.c:160: warning: assignment discards qualifiers from pointer target type
strings.c:182: warning: assignment discards qualifiers from pointer target type
make: *** [OBJ.x86_64-unknown-linux-gnu/strings.o] Error 1

Any suggestions?

Cheers,

Pierre

--
Scientist
Landcare Research, New Zealand

Pierre Roudier wrote:

I got the following error when compiling against the last update of
the grass7 trunk:

OBJ.x86_64-unknown-linux-gnu/strings.o -c strings.c
strings.c:136: error: conflicting types for �G_str_replace�
/usr/local/src/grass_trunk/dist.x86_64-unknown-linux-gnu/include/grass/gisdefs.h:580:
note: previous declaration of �G_str_replace� was here

Any suggestions?

Are you running "make" from the top-level directory, or are you trying
to compile just part of the tree?

r45541 modified the prototype for G_str_replace() in both
lib/gis/strings.c and include/gisdefs.h. Running "make" in the
"include" directory should install the updated gisdefs.h file to
dist.<arch>/include/grass/gisdefs.h, but this won't happen if you try
to build the "lib" or "lib/gis" directories alone.

In any case, running "make clean" first should fix the problem, even
though it shouldn't be necessary.

FWIW, the lines in question should be:

include/gisdefs.h:580:

  char *G_str_replace(const char *, const char *, const char *);

(and also for dist.<arch>/include/grass/gisdefs.h).

lib/gis/strings.c:136:

  char *G_str_replace(const char *buffer, const char *old_str, const char *new_str)

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

Thanks for your pointers,

After a clean checkout and a make clean, it compiled successfully.

Cheers,

Pierre

2011/3/21 Glynn Clements <glynn@gclements.plus.com>:

Pierre Roudier wrote:

I got the following error when compiling against the last update of
the grass7 trunk:

OBJ.x86_64-unknown-linux-gnu/strings.o -c strings.c
strings.c:136: error: conflicting types for �G_str_replace�
/usr/local/src/grass_trunk/dist.x86_64-unknown-linux-gnu/include/grass/gisdefs.h:580:
note: previous declaration of �G_str_replace� was here

Any suggestions?

Are you running "make" from the top-level directory, or are you trying
to compile just part of the tree?

r45541 modified the prototype for G_str_replace() in both
lib/gis/strings.c and include/gisdefs.h. Running "make" in the
"include" directory should install the updated gisdefs.h file to
dist.<arch>/include/grass/gisdefs.h, but this won't happen if you try
to build the "lib" or "lib/gis" directories alone.

In any case, running "make clean" first should fix the problem, even
though it shouldn't be necessary.

FWIW, the lines in question should be:

include/gisdefs.h:580:

   char \*G\_str\_replace\(const char \*, const char \*, const char \*\);

(and also for dist.<arch>/include/grass/gisdefs.h).

lib/gis/strings.c:136:

   char \*G\_str\_replace\(const char \*buffer, const char \*old\_str, const char \*new\_str\)

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

--
Scientist
Landcare Research, New Zealand