Hi,<br>I don&#39;t have access to a computer with R atm so I can&#39;t try. But the <br> includes=&quot;#include &lt;ctime&gt;, #include &lt;time.h&gt;, #include &lt;algorithm&gt;. #include &lt;vector&gt;&quot;<br>looks fishy to me. First of all, note the dot before the last &quot;include&quot; instead of a comma. Secondly: wouldn&#39;t you need something like the below?<br>

includes=c(&quot;#include &lt;ctime&gt;&quot;,&quot;#include &lt;time.h&gt;&quot;, &quot;#include &lt;algorithm&gt;&quot;, &quot;#include &lt;vector&gt;&quot;)<br><br>Sorry if I am completely off here. Like I said, can&#39;t try right now...<br>

<br>Regards,<br>Jonas<br>
<br><div class="gmail_quote">On Thu, Sep 22, 2011 at 10:43 AM, Noah Silverman <span dir="ltr">&lt;<a href="mailto:noahsilverman@ucla.edu">noahsilverman@ucla.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi,<br>
<br>
I have a vector of doubles that I want to sort.<br>
<br>
Using Rcpp and inline.  When attempting to create the function,  I receive an error.  Does anybody have any suggestions?<br>
<br>
===================<br>
Test &lt;- cxxfunction(<br>
        signature(),<br>
        plugin=&quot;Rcpp&quot;, includes=&quot;#include &lt;ctime&gt;, #include &lt;time.h&gt;, #include &lt;algorithm&gt;. #include &lt;vector&gt;&quot;,<br>
        body=&quot;<br>
                std::vector&lt;double&gt; data;<br>
<br>
                for(int i=0; i != 20; i++){<br>
                        data.push_back(i);<br>
                }<br>
                std::sort(data.front(), data.back());<br>
                return Rcpp::wrap(data);<br>
        &quot;<br>
)<br>
<br>
<br>
Error in compileCode(f, code, language = language, verbose = verbose) :<br>
  Compilation ERROR, function(s)/method(s) not created! /usr/include/c++/4.2.1/bits/stl_iterator_base_types.h: In instantiation of ‘std::iterator_traits&lt;double&gt;’:<br>
/usr/include/c++/4.2.1/bits/stl_algo.h:2819:   instantiated from ‘void std::sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = double]’<br>
file6fb6ff92.cpp:36:   instantiated from here<br>
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h:129: error: ‘double’ is not a class, struct, or union type<br>
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h:130: error: ‘double’ is not a class, struct, or union type<br>
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h:131: error: ‘double’ is not a class, struct, or union type<br>
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h:132: error: ‘double’ is not a class, struct, or union type<br>
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h:133: error: ‘double’ is not a class, struct, or union type<br>
/usr/include/c++/4.2.1/b<br>
In addition: Warning message:<br>
running command &#39;/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file6fb6ff92.cpp 2&gt; file6fb6ff92.cpp.err.txt&#39; had status 1<br>
<br>
===========================<br>
--<br>
Noah Silverman<br>
UCLA Department of Statistics<br>
8117 Math Sciences Building #8208<br>
Los Angeles, CA 90095<br>
<br>
_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
</blockquote></div><br>