C++ in GRASS

Brett Hoover bahoover at micron.net
Fri Nov 13 16:06:07 EST 1998


Without any information about the error messages I can't be sure, but it
sounds like you need to wrap function declarations in an extern wrapper so
the names don't get manged.  This would be done in the header file.

Example:

#ifdef _cplusplus
extern "C" {
#endfi
int function1( int var1, int var2 ) ;
char *function2( int var1, int var2 );
...
#ifdef _cplusplus
}
#endif

The problem is, that this would have to be done for all header files which
declares a function you need.

Hope this helps (or at least points you in the right direction)

brett

-----Original Message-----
From: Olaf Hellwich <olaf at sun7.photo.verm.tu-muenchen.de>
To: grass at cecer.army.mil <grass at cecer.army.mil>
Date: Friday, November 13, 1998 1:41 PM
Subject: C++ in GRASS


>Hi GRASS programmers,
>
>Does anybody know how to incorporate C++ code into GRASS programs?
>
>We tried to use g++ instead of gcc and moved our source to a .cpp
>filename ... only realizing that compilation failed with a bunch
>of error messages. So this doesn't seem to be a promising way.
>
>Thanks for your help.
>
>Olaf
>



More information about the grass-user mailing list