[GRASSLIST:4684] malloc alloc conflicting types in alloc.c in dbmi

Hello GRASS users,

Here is a question for the "programming-oriented" people:

I am compiling 5.3 source in the new Linux Mandrake 10.1 S.O and I get the
following modules with errors:

Compilation error in module: src/libes/dbmi/clients (ignored)
Compilation error in module: src/display/d.db (ignored)
Compilation error in module: src/display/d.what.db (ignored)
Compilation error in module: src/display/d.what.vect (ignored)
Compilation error in module: src/mapdev/v.db.reclass (ignored)
Compilation error in module: src/mapdev/v.out.shape (ignored)
Compilation error in module: src/mapdev/v.to.db (ignored)
Compilation error in module: src/raster/r.in.gdal (ignored)
Compilation error in module: src/raster/r.mapcalc3 (ignored)
Compilation error in module: src.contrib/SDTS (ignored)
Compilation error in module: src/libes/dbmi/drivers/odbc (ignored)

when compiling the first error module with gmake53 I get the following error
stating that the malloc and alloc declaration in the first lines of the file
alloc.c is of conflicting types.

alloc.c:4: error: conflicting types for 'malloc'
alloc.c:4: error: conflicting types for 'malloc'
alloc.c:5: error: conflicting types for 'calloc'
alloc.c:5: error: conflicting types for 'calloc'
make[1]: *** [OBJ.i686-pc-linux-gnu/alloc.o] Error 1
make[1]: Leaving directory `/usr/local/grass-5.3.0/src/libes/dbmi/lib'
make: *** [all] Error 2

The first lines of alloc.c are:

#include "dbmi.h"
#include <string.h>

extern char *malloc();
extern char *calloc();
extern char *realloc();

Can it be something to do with stdc++ libraries?

If anybody has an idea please let me know?

Ciao
Francesco Pirotti

francesco.pirotti wrote:

when compiling the first error module with gmake53 I get the following error
stating that the malloc and alloc declaration in the first lines of the file
alloc.c is of conflicting types.

alloc.c:4: error: conflicting types for 'malloc'
alloc.c:4: error: conflicting types for 'malloc'
alloc.c:5: error: conflicting types for 'calloc'
alloc.c:5: error: conflicting types for 'calloc'
make[1]: *** [OBJ.i686-pc-linux-gnu/alloc.o] Error 1
make[1]: Leaving directory `/usr/local/grass-5.3.0/src/libes/dbmi/lib'
make: *** [all] Error 2

The first lines of alloc.c are:

#include "dbmi.h"
#include <string.h>

extern char *malloc();
extern char *calloc();
extern char *realloc();

It should include <stdlib.h> rather than supplying its own (incorrect)
declarations.

I've fixed this in CVS.

Can it be something to do with stdc++ libraries?

Not unless you're trying to compile GRASS with a C++ compiler. Most of
GRASS is written in C; r.terraflow is the only module which is written
in C++, and that's only compiled if you use the --with-cxx switch.

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