[GRASS5] Modules in C++?

Glynn Clements glynn.clements at virgin.net
Thu Mar 20 22:58:20 EST 2003

Redding, Matthew wrote:

> I have started tinkering with GRASS, and in this process of learning a
> bit about
> grass, I would like to be able to learn a little more about C++.
> Now I know that the programming standard for GRASS is to use C, not C++.
> Is it possible for, for my purposes, to work with C++ not C, and what
> needs to be done?
> Does it require largescale mucking around with gmake?

It's possible, but:

1. You need to use the code from the CVS HEAD; neither the release
branch nor any of the release tarballs support C++.

2. Your C++ compiler needs to be highly compatible with your C
compiler, as the same compilation switches are used regardless of

3. The GRASS header files aren't compatible with C++, so you need to
wrap any #include directives, e.g.:

	extern "C" {
	#include <gis.h>

There may be other issues.

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-dev mailing list