On 10 July 2012 at 21:01, Jiqiang Guo wrote:
| Dear List:
| 
| I case across an error on Windows 7 64bits,  any idea how can I avoid that? 
| I wish I could provide a demonstrative example, but it's too complicated now. 
| 
| This is the error report:

It really helps when you show __code__ producing the error in question.

Here I can only surmise that you used 'long long' which is not permitted on
CRAN as its mandated compilers versions do not (yet) support C++11. Which is
why Rcpp (as shipped from CRAN) cannot support it. 

It works if you use the
   
   -std=c++11

flag as an option to PKG_CXXFLAGS for both Rcpp and Rstan --- but then you
won't be able to upload this.

Rcpp does this in RcppCommon.h:  if g++ is used, and -std=c++11 has been
activated, and if we see LONG_LONG_MAX (coming from the system headers)
__then__ do we define RCPP_HAD_LONG_LONG_TYPES :
package:

#ifdef __GNUC__
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#ifdef LONG_LONG_MAX
    __extension__ typedef long long int rcpp_long_long_type;
    __extension__ typedef unsigned long long int rcpp_ulong_long_type;
    #define RCPP_HAS_LONG_LONG_TYPES
#endif
#endif
#endif

You can protect your code with RCPP_HAD_LONG_LONG_TYPES tests in an #ifdef, a
few of our packages do that as eg my most recent upload

#ifdef RCPP_HAS_LONG_LONG_TYPES
        } else if (type == "integer") {
            int64_t *p = reinterpret_cast<int64_t*>(arr.data);
            ret = Rcpp::IntegerVector(p, p + shape[0]);
#endif

as int64_t does in fact become "long long int" on 32 bit systems...

Dirk

-- 
Dirk Eddelbuettel | [email protected] | http://dirk.eddelbuettel.com  
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to