全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
5266 4
2011-11-16
rcpp.txt
大小:(1.06 KB)

 马上下载

我按照一个网上的案例来做的,结果总是提示错误。好像在编译器上,我用的编译器是vc6.0,在windows 7下运行。请大家运行下附件中的代码,帮我看看问题处在哪里了。

我运行的结果如下:
ERROR(s) during compilation: source code errors or compiler configuration errors!
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 file3bfc83e( SEXP n_, SEXP width_, SEXP format_) ;
24: }
25:
26: // definition
27:
28: SEXP file3bfc83e( SEXP n_, SEXP width_, SEXP format_ ){
29: BEGIN_RCPP
30:
31:
32:         int n = as(n_) ;
33:         int width = as( width_ ) ;
34:         const char* format = as( format_ ) ;
35:         
36:         std::string buffer( width, '0' ) ;
37:         std::vector< std::string > elements( n ) ;
38:         for( int i=0; i( buffer.data() ),
39:                 format,
40:                 i+1
41:             ) ;
42:             elements = buffer.c_str() ;
43:         }
44:         
45:         std::stringstream ss ;
46:         
47:         
48:         CharacterVector res( n*(n-1)/2) ;
49:         for( int i=0, k=0; i<n-1; i++){
50:             for( int j=i+1; j<n; j++, k++){
51:                 ss << "i" << elements << "." << elements[j] ;
52:                 res[k] = ss.str() ;
53:                 ss.str("") ;
54:             }
55:         }
56:         
57:         return res ;
58:     
59: END_RCPP
60: }
61:
62:
Error in compileCode(f, code, language = language, verbose = verbose) :
  Compilation ERROR, function(s)/method(s) not created!
In addition: Warning message:
running command 'C:/PROGRA~1/R/R-213~1.1/bin/i386/R CMD SHLIB file3bfc83e.cpp 2> file3bfc83e.cpp.err.txt' had status 1
>

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2011-11-16 22:42:42
什么玩意儿!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-11-16 23:09:22
Rcpp only works with the GNU toolchain.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-11-18 00:06:39
soccy 发表于 2011-11-16 23:09
Rcpp only works with the GNU toolchain.
那应该用什么编辑器?莫非一定要在lunix下面跑?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-11-18 02:20:44
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群