[Rcpp-devel] Rcpp compile question
Henry Bee
henry.bee at gmail.com
Tue Mar 22 20:16:35 CET 2011
Hi Christian,
Thanks for the source file. Below are the full results as you requested.
It's giving the same error as before. Is 64-bit R supported?
Henry
> source('tmp.R', verbose = TRUE)
'envir' chosen:<environment: R_GlobalEnv>
encoding = "native.enc" chosen
--> parsed 3 expressions; now eval(.)ing them:
>>>> eval(expression_nr. 1 )
=================
> require(inline)
curr.fun: symbol require
.. after ‘expression(require(inline))’
>>>> eval(expression_nr. 2 )
=================
> src <- '
+ Rcpp::NumericVector xa(a);
+ Rcpp::NumericVector xb(b);
+ int n_xa = xa.size(), n_xb = xb.size();
+
+ Rcpp::NumericVector xab(n_xa + n_x .... [TRUNCATED]
curr.fun: symbol <-
.. after ‘expression(src <- '’‘Rcpp::NumericVector
xa(a);’‘Rcpp::NumericVector xb(b);’‘int n_xa = xa.size(), n_xb =
xb.size();’‘’‘Rcpp::NumericVector xab(n_xa + n_xb - 1);’‘for (int i = 0; i <
n_xa; i++)’‘for (int j = 0; j < n_xb; j++)’‘xab[i + j] += xa[i] *
xb[j];’‘return xab;’‘')’
>>>> eval(expression_nr. 3 )
=================
> fun <- cxxfunction( signature(a="numeric", b="numeric"), src,
plugin="Rcpp", verbose=TRUE)
>> setting environment variables:
PKG_LIBS =
D:/Users/Henry/Documents/R/win-library/2.12/Rcpp/lib/x64/libRcpp.a
>> LinkingTo : Rcpp
CLINK_CPPFLAGS =
-I"D:/Users/Henry/Documents/R/win-library/2.12/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 file5a2532f3( SEXP a, SEXP b) ;
24 : }
25 :
26 : // definition
27 :
28 : SEXP file5a2532f3( SEXP a, SEXP b ){
29 : BEGIN_RCPP
30 :
31 : Rcpp::NumericVector xa(a);
32 : Rcpp::NumericVector xb(b);
33 : int n_xa = xa.size(), n_xb = xb.size();
34 :
35 : Rcpp::NumericVector xab(n_xa + n_xb - 1);
36 : for (int i = 0; i < n_xa; i++)
37 : for (int j = 0; j < n_xb; j++)
38 : xab[i + j] += xa[i] * xb[j];
39 : return xab;
40 :
41 : END_RCPP
42 : }
43 :
44 :
Compilation argument:
C:\PROGRA~1\R\R-212~1.2/bin/x64/R CMD SHLIB file5a2532f3.cpp 2>
file5a2532f3.cpp.err.txt
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 file5a2532f3( SEXP a, SEXP b) ;
24: }
25:
26: // definition
27:
28: SEXP file5a2532f3( SEXP a, SEXP b ){
29: BEGIN_RCPP
30:
31: Rcpp::NumericVector xa(a);
32: Rcpp::NumericVector xb(b);
33: int n_xa = xa.size(), n_xb = xb.size();
34:
35: Rcpp::NumericVector xab(n_xa + n_xb - 1);
36: for (int i = 0; i < n_xa; i++)
37: for (int j = 0; j < n_xb; j++)
38: xab[i + j] += xa[i] * xb[j];
39: return xab;
40:
41: END_RCPP
42: }
43:
44:
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-212~1.2/bin/x64/R CMD SHLIB
file5a2532f3.cpp 2> file5a2532f3.cpp.err.txt' had status 1
>
2011/3/21 Christian Gunning <icos.atropa at gmail.com>
> "Here's the command:"
>
> Works for me. Try sourcing the attached file (which includes your
> command, +verbose=T), and post back the *full* results, including the
> source('tmp.R.txt') command and the next prompt line.
>
> -christian
>
> --
> A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110322/dcc3a414/attachment.htm>
More information about the Rcpp-devel
mailing list