GRASS and C++, postscript

Martin Ameskamp ma at informatik.uni-kiel.d400.de
Tue Dec 19 07:00:00 EST 1995


Hi there,

I posted some advice about using GRASS with C++ yesterday, but I forgot to
mention one or two details.

C++ needs full prototypes of external functions - these are provided in
the file grass-defs.h I put on the moon.
grass-defs.h includes gis.h for type definitions and constants, which is no
problem except for the fact that gis.h includes gisdefs.h - which is full of
horrible K&R 'prototypes' (i.e. gives return types for some functions).
C++ compilers don't like these things and the best way of solving the
problem - IMHO - is to bracket gisdefs.h by
#ifndef __cplusplus
...
gisdefs.h things
...
#endif

Every selfrespecting C++ compiler defines this symbol, no C compiler
defines it, so you can work in C++ and GRASS code will compile as before.
The same thing can be done wherever the odd K&R prototype is included
(src/mapdev/diglib/dig_externs.h is another case).

Martin

PS postscript as in PS, not as in <file>.ps!
--
Martin Ameskamp, Inst. f. Informatik I (Computing Dept.)
Kiel University, Olshausenstr. 40, 24118 Kiel, Germany
Fax: ++49 431 8804054, Voice: ++49 431 8804474, 
email: ma at informatik.uni-kiel.d400.de





More information about the grass-dev mailing list