[R] Interfacing R and C++ under Windows

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Fri Jan 3 15:09:13 CET 2003

On Fri, 3 Jan 2003, Pijus Virketis wrote:

> My colleague, who has been helping me with wrapping some older C++ code for use in R, has been running into some issues, which he asked me to post here:
> - ERROR is defined in RS.h which is included in Rdefines.h which conflicts with Visual Studio's ERROR
> - TRACE is defined in Rinternals.h which conflicts with Visual Studio's TRACE
> - math.h is included within extern "C" linkage in R.h, however Visual Studio's math.h includes templates which are only valid in C++
> Basically, he feels that there are some clear conflicts between what
R expects of C++ and what Visual C++ does. So, while the simpler .C
technique can be used, the .Call approach does not work. What are we missing

A real C++ compiler (and enough netiquette to wrap your lines).

Why are you using VC++ with R: it is most definitely not the recommended C
compiler?  Using standard C++ and the recommended compiler usually works,
modulo undefining symbols defined in windows.h or its dependencies.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list