Message error 'C:/Program' not found with Rcpp

后端 未结 2 985
北恋
北恋 2020-12-19 13:48

I\'m running a 64-bit Windows 7 platform.

I have added to my installed programs/libraries:

  • Rtools

  • R (software)

  • Rcpp

相关标签:
2条回答
  • 2020-12-19 14:26

    Following nograpes suggestion I get:

    >> setting environment variables: 
    PKG_LIBS =  C:/Users/ (...) /DOCUME~1/R/WIN-LI~1/3.0/Rcpp/lib/x64/libRcpp.a
    
    >> LinkingTo : Rcpp
    CLINK_CPPFLAGS =  -I"C:/Users/  (...)  /Documents/R/win-library/3.0/Rcpp/include" 
    
    >> Program source:
    
    1 : 
    2 : // includes from the plugin
    3 : 
    4 : #include <Rcpp.h>
    5 : 
    6 : 
    7 : #ifndef BEGIN_RCPP
    8 : #define BEGIN_RCPP
    9 : #endif
    10 : 
    11 : #ifndef END_RCPP
    12 : #define END_RCPP
    13 : #endif
    14 : 
    15 : using namespace Rcpp;
    16 : 
    17 : 
    18 : // user includes
    19 : 
    20 : 
    21 : // declarations
    22 : extern "C" {
    23 : SEXP file47844fc6c7a( SEXP ns, SEXP xs) ;
    24 : }
    25 : 
    26 : // definition
    27 : 
    28 : SEXP file47844fc6c7a( SEXP ns, SEXP xs ){
    29 : BEGIN_RCPP
    30 : int n = as<int>(ns);
    31 : double x = as<double>(xs);
    32 : for (int i=0; i<n; i++) x=1/(1+x);
    33 : return wrap(x); 
    34 : END_RCPP
    35 : }
    36 : 
    37 : 
    
    Compilation argument:
     C:/Program Files/R-3.0.1/bin/x64/R CMD SHLIB file47844fc6c7a.cpp 2>         file47844fc6c7a.cpp.err.txt 
    Error in file(con, "r") : cannot open the connection
    In addition: Warning message:
    In file(con, "r") :
      cannot open file 'file47844fc6c7a.cpp.err.txt': No such file or directory
    

    But, I admit that doesn't help me that much.

    0 讨论(0)
  • 2020-12-19 14:34

    The R on Windows FAQ says in Question 2.2:

    If you want to be able to build packages from sources, we recommend that you choose an installation path not containing spaces.

    Also see Question 2.16 of that FAQ. I am fairly certain that we also make that point repeatedly in the Rcpp documentation.

    Now, if you forgo the inline package, and try working in RStudio, then you might get around this (as there are more efforts to protect the $PATH with spaces).

    But in short, I would reinstall R into, say C:\R\R-$version as it is the only way to get default behaviour on all examples. And we have lots of them. It's worth reinstalling.

    0 讨论(0)
提交回复
热议问题