And the error he gets is:<div><br></div><div><span class="Apple-style-span" style="border-collapse: collapse; color: rgb(68, 68, 68); font-family: Calibri, Verdana, Helvetica, Arial; font-size: 15px; ">Error in compileCode(f, code, language = language, verbose = verbose) : <br>

  Compilation ERROR, function(s)/method(s) not created! file786264e8.cpp: In function ‘SEXPREC* file786264e8()’:<br>file786264e8.cpp:33: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:<br>

/Library/Frameworks/R.framework/Versions/2.13/Resources/library/Rcpp/include/Rcpp/sugar/operators/plus.h:451: note: candidate 1: Rcpp::sugar::Plus_Vector_Primitive&lt;RTYPE, NA, T&gt; operator+(const Rcpp::VectorBase&lt;RTYPE, NA, VECTOR&gt;&amp;, typename Rcpp::traits::storage_type&lt;RTYPE&gt;::type) [with int RTYPE = 14, bool NA = true, T = Rcpp::Vector&lt;14&gt;]<br>

file786264e8.cpp:33: note: candidate 2: operator+(SEXPREC*, int) &lt;built-in&gt;<br>make: *** [file786264e8.o] Error 1<br>In addition: Warning message:<br>running command &#39;/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file786264e8.cpp 2&gt; file786264e8.cpp.err.txt&#39; had status 1 </span><br>

<br><div class="gmail_quote">2011/5/16 Sacha Epskamp <span dir="ltr">&lt;<a href="mailto:sacha.epskamp@gmail.com">sacha.epskamp@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi,<div><br></div><div>Here is a small example:</div><div><br></div><div><div><br></div><div>library(&quot;Rcpp&quot;)</div><div>library(&quot;inline&quot;)</div><div><br></div><div>fun &lt;-cxxfunction(,</div><div>&#39;</div>


<div>Environment e = Environment::global_env(); </div><div>NumericVector bar = e[&quot;foo&quot;];</div><div>bar = bar + 1;</div><div>return wrap(bar);</div><div>&#39;,plugin=&quot;Rcpp&quot;)</div><div><br></div><div>foo &lt;- 1:10</div>


<div><br></div><div>fun()</div><div><br></div><div>This function works fine on my windows netbook, but does not work on my supervisors mac. His computers specs are:</div><div><br></div><div><span style="border-collapse:collapse;color:rgb(68, 68, 68);font-family:Calibri, Verdana, Helvetica, Arial;font-size:15px">++++++++++<br>


<br>platform       i386-apple-darwin9.8.0       <br>arch           i386                         <br>os             darwin9.8.0                  <br>system         i386, darwin9.8.0            <br>status                                      <br>


major          2                            <br>minor          13.0                         <br>year           2011                         <br>month          04                           <br>day            13                           <br>


svn rev        55427                        <br>language       R                            <br>version.string R version 2.13.0 (2011-04-13)<br><br><br>++++++++++++++<br><br>packageDescription(&#39;Rcpp&#39;)<br>Package: Rcpp<br>


Title: Seamless R and C++ Integration<br>Version: 0.9.4<br><br><br>+++++++++++++++<br>&gt; packageDescription(&#39;Inline&#39;)<br>Package: inline<br>Version: 0.3.8<br>Date: 2010-12-07<br>++++++++++++++++<br><br><br>&gt; system(&quot;g++ --version&quot;)<div class="im">

<br>
i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)<br>Copyright (C) 2007 Free Software Foundation, Inc.<br>This is free software; see the source for copying conditions.  There is NO<br>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<br>


<br></div></span></div><div><span style="border-collapse:collapse;color:rgb(68, 68, 68);font-family:Calibri, Verdana, Helvetica, Arial;font-size:15px"><br></span></div><div><span style="border-collapse:collapse;color:rgb(68, 68, 68);font-family:Calibri, Verdana, Helvetica, Arial;font-size:15px">Best,</span></div>


<div><span style="border-collapse:collapse;color:rgb(68, 68, 68);font-family:Calibri, Verdana, Helvetica, Arial;font-size:15px">Sacha</span></div><div><div></div><div class="h5"><br><div class="gmail_quote">2011/5/16 Romain Francois <span dir="ltr">&lt;<a href="mailto:romain@r-enthusiasts.com" target="_blank">romain@r-enthusiasts.com</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
Let&#39;s try to narrow this down.<br>
<br>
Please provide a small and reproducible example.<br>
<br>
What is the version of the compiler. This is what I have on my iMac:<br>
$ g++ --version<br>
i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)<br>
Copyright (C) 2007 Free Software Foundation, Inc.<br>
This is free software; see the source for copying conditions.  There is NO<br>
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<br>
<br>
What version of Rcpp are you using. What version of R.<br>
<br>
Romain<br>
<br>
Le 16/05/11 12:06, Sacha Epskamp a écrit :<div><div></div><div><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear mailing list,<br>
<br>
For a project I am working on speeding up a simulation in R by<br>
translating it to C++ (using inline and Rcpp). It is done and works fine<br>
on my windows 7 64bit R, but for some reason it is not working on my<br>
supervisors latest mac OSX (not sure of the version. should be up to date).<br>
<br>
The strange thing is that it did work at first. It compiled and ran as<br>
expected. We then proceeded by changing a few things, resulting in the<br>
function not compiling anymore. When we then used exactly the same<br>
script as before it suddenly did not work anymore. I get these errors:<br>
<br>
<br>
Error in compileCode(f, code, language = language, verbose = verbose) :<br>
   Compilation ERROR, function(s)/method(s) not created!<br>
file345af547.cpp: In function ‘SEXPREC* file345af547(SEXPREC*, SEXPREC*,<br>
SEXPREC*, SEXPREC*, SEXPREC*, SEXPREC*)’:<br>
file345af547.cpp:220: error: ISO C++ says that these are ambiguous, even<br>
though the worst conversion for the first is better than the worst<br>
conversion for the second:<br>
/Library/Frameworks/R.framework/Versions/2.13/Resources/library/Rcpp/include/Rcpp/sugar/operators/minus.h:421:<br>
note: candidate 1: Rcpp::sugar::Minus_Vector_Primitive&lt;RTYPE, NA, T&gt;<br>
operator-(const Rcpp::VectorBase&lt;RTYPE, NA, VECTOR&gt;&amp;, typename<br>
Rcpp::traits::storage_type&lt;RTYPE&gt;::type) [with int RTYPE = 14, bool NA =<br>
true, T = Rcpp::Vector&lt;14&gt;]<br>
file345af547.cpp:220: note: candidate 2: operator-(SEXPREC*, int) &lt;built-in&gt;<br>
file345af547.cpp:646: error: ISO C++ says that these are ambiguous, even<br>
though the worst conversion for the first is better than the worst<br>
conversion for the second:<br>
/Library/Frameworks/R.framework/Versions/2.13/Resources/librar<br>
In addition: Warning message:<br>
running command &#39;/Library/Frameworks/R.framework/Resources/bin/R CMD<br>
SHLIB file345af547.cpp 2&gt; file345af547.cpp.err.txt&#39; had status 1<br>
<br>
With relevant lines:<br>
<br>
  220 : Demoplayers = Demoplayers - 1;<br>
<br>
  646 : leeftijd = leeftijd + 1;<br>
<br>
Demoplayers and leeftijd are both NumericVectors. Does anyone know if<br>
there is a common bug on MacOSX that for some reason makes the inline<br>
compiler not work anymore? The cxxfunction example works fine though.<br>
<br>
Best,<br>
Sacha<br>
</blockquote>
<br></div></div>
-- <br>
Romain Francois<br>
Professional R Enthusiast<br>
+33(0) 6 28 91 30 30<br>
<a href="http://romainfrancois.blog.free.fr" target="_blank">http://romainfrancois.blog.free.fr</a><br>
<a href="http://romain-francois.com" target="_blank">http://romain-francois.com</a><br>
|- <a href="http://bit.ly/hdKhCy" target="_blank">http://bit.ly/hdKhCy</a> : Rcpp article in JSS<br>
|- <a href="http://bit.ly/elZJRJ" target="_blank">http://bit.ly/elZJRJ</a> : Montpellier Comedie Club - Avril 2011<br>
`- <a href="http://bit.ly/fhqbRC" target="_blank">http://bit.ly/fhqbRC</a> : Rcpp workshop in Chicago on April 28th<br>
<br>
<br>
_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">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></div></div></div>
</blockquote></div><br></div>