[R] Conflicting headers (was R_qsort_int_I() error)

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Mar 21 10:34:50 CET 2004


Do look at the code: Rmath.h contains

#ifdef MATHLIB_STANDALONE
 typedef enum { FALSE = 0, TRUE } Rboolean;
#else
# include <R_ext/Boolean.h>

/* for API back-compatibility -- DEPRECATED since R 1.2 -- */
#define LTRUE  TRUE
#define LFALSE FALSE
#endif

Is this code to be linked into R?  If so you should not be defining
MATHLIB_STANDALONE: if not, you should not be using R_ext/Utils.h.


On Fri, 19 Mar 2004, Kosuke Imai wrote:

> Hi,
>    I want to use R_qsort_int_I() in my C function, but getting the 
> following error. It looks like there is a conflict between Rmath.h, 
> which I use to generate random numbers, and R_ext/Boolean.h I would 
> appreciate any help to fix this problem.
> 
> gcc -ansi -g -o Gibbs gibbs.c subroutines.o rand.o vector.o -lm -lRmath 
> -llapack -lblas -lfrtbegin -lg2c -lm -shared-libgcc
> In file included from /usr/include/R_ext/Utils.h:27,
>                   from gibbs.c:7:
> /usr/include/R_ext/Boolean.h:29: conflicting types for `FALSE'
> /usr/include/Rmath.h:175: previous declaration of `FALSE'
> /usr/include/R_ext/Boolean.h:29: conflicting types for `TRUE'
> /usr/include/Rmath.h:175: previous declaration of `TRUE'
> /usr/include/R_ext/Boolean.h:29: confused by earlier errors, bailing out
> make: *** [Gibbs] Error 1

> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

PLEASE do, and don't use misleading subject lines.

-- 
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