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 Thanks, Kosuke --------------------------------------------------------- Kosuke Imai Office: Corwin Hall 041 Assistant Professor Phone: 609-258-6601 (Direct) Department of Politics Fax: 609-258-1110 (Department) Princeton University Email: kimai at Princeton.Edu Princeton, NJ 08544-1012 http://www.princeton.edu/~kimai
Prof Brian Ripley
2004-Mar-21 09:34 UTC
[R] Conflicting headers (was R_qsort_int_I() error)
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.htmlPLEASE 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