Ah!  I had all the latest versions on my office computer and forgot to update my laptop as well (which had Rcpp from 0.8.6. from 9/2010 or so).<div><br></div><div>Thanks.</div><div>Chris<br><br><div class="gmail_quote">On Wed, May 18, 2011 at 9:07 AM, Dirk Eddelbuettel <span dir="ltr">&lt;<a href="mailto:edd@debian.org">edd@debian.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5"><br>
On 18 May 2011 at 08:42, Chris DuBois wrote:<br>
| Hi all,<br>
|<br>
| I&#39;ve copied the following from a portion of the &quot;Using matrices&quot; section of the<br>
| Rcpp Quick Reference guide.  I get a compilation error that I&#39;m having trouble<br>
| decoding.  Commenting out the third line allows it to compile, so it must be<br>
| something I&#39;ve done wrong with the column selector, but I don&#39;t see it.  <br>
|<br>
| Thanks in advance,<br>
| Chris<br>
|<br>
| PS. My g++ version is 4.5.2, in case that helps.<br>
|<br>
| src &lt;- &#39;<br>
| NumericMatrix xx(4, 5);<br>
| std::fill(xx.begin(), xx.end(), 8);<br>
| NumericMatrix::Column zzcol = xx( _, 1);<br>
| return(wrap(1));<br>
|  &#39;<br>
| fun &lt;-  cxxfunction(signature(x=&quot;numeric&quot;), body = src, plugin=&quot;Rcpp&quot;)<br>
|<br>
| file3011595e.cpp:35:39: error: invalid conversion from ‘SEXPREC*’ to<br>
| ‘int’<br>
| file3011595e.cpp:35:39: error:   initializing argument 1 of ‘Rcpp::Matrix<br>
| &lt;RTYPE&gt;::Proxy Rcpp::Matrix&lt;RTYPE&gt;::operator()(int, int) [with int RTYPE = 14,<br>
| Rcpp::Matrix&lt;RTYPE&gt;::Proxy = double&amp;]’<br>
| file3011595e.cpp:35:39: error: conversion from ‘Rcpp::traits::storage_type<br>
| &lt;14&gt;::type’ to non-scalar type ‘Rcpp::Matrix&lt;14&gt;::Column’ requested<br>
| make: *** [file3011595e.o] Error 1<br>
<br>
</div></div>Works for me:<br>
<br>
R&gt; src &lt;- &#39;<br>
<div class="im">+ NumericMatrix xx(4, 5);<br>
+ std::fill(xx.begin(), xx.end(), 8);<br>
+ NumericMatrix::Column zzcol = xx( _, 1);<br>
+ return(wrap(1));<br>
</div>+ &#39;<br>
R&gt; fun &lt;- cxxfunction(signature(x=&quot;numeric&quot;), body = src, plugin=&quot;Rcpp&quot;)<br>
R&gt; fun(4.44)<br>
[1] 1<br>
R&gt;<br>
<br>
Are you by chance using an ancient Rcpp version?<br>
<br>
Dirk<br>
<font color="#888888"><br>
--<br>
Gauss once played himself in a zero-sum game and won $50.<br>
                      -- #11 at <a href="http://www.gaussfacts.com" target="_blank">http://www.gaussfacts.com</a><br>
</font></blockquote></div><br></div>