搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  rcpp.txt
资料下载链接地址: https://bbs.pinggu.org/a-996486.html
附件大小:
我按照一个网上的案例来做的,结果总是提示错误。好像在编译器上,我用的编译器是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
>



    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

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

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

GMT+8, 2026-1-2 02:37