[OSRS-PROJ] C++ friendly header file?

Frank Warmerdam warmerda at home.com
Thu Mar 30 10:11:17 PST 2000


Rick Brownrigg wrote:
> 
> I've used this library for years, and its great to see renewed interest
> in it.
> 
> As I typically use C++, I've found that I have problems linking my
> code.  My quick-N-dirty solution is to patch the "projects.h" header
> file, surround everything by
> 
>     #ifdef __cplusplus
>         #extern "C" {
>     endif
>     ...
>     #ifdef __cplusplus
>         }
>     #endif
> 
> directives.  This is easy enough to do, but I inevitably forget for new
> installations.  There may also be a cleaner approach, and I admit I
> haven't investigated thoroughly.
> 
> Anyone else see this?  Have better solutions?  More to the point, could
> we get whatever prefered solution incorporated into the next release?

Rick,

Excellent idea. I have applied this to projects.h and geodesic.h in CVS.
This is the standard way I handle C linkage header files I want to be compatible
with C++.  

Note that it's "extern "C" {" not "#extern "C" {".

Best regards,

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerda at home.com
light and sound - activate the windows | http://members.home.com/warmerda
and watch the world go round - Rush    | Geospatial Programmer for Rent
----------------------------------------
OSRS PRoject PROJ Discussion List
To Subscribe: send a message to majordomo at remotesensing.org with 'subscribe osrs-proj' in the body
To Unsubscribe: send a message to majordomo at remotesensing.org with 'unsubscribe osrs-proj' in the body
To Report Problems: send a message to owner-osrs-proj at remotesensing.org



More information about the Proj mailing list