<div><font class="Apple-style-span" color="#ff0000">Thanks for your reply.</font></div><div><font class="Apple-style-span" color="#ff0000"><br></font></div><div><font class="Apple-style-span" color="#ff0000">Here is the response of &#39;Hello World&#39; program:</font></div>
<div><br></div><div><div><div><div>&gt; src=&#39;#include &lt;iostream&gt;</div><div>+ using namespace std;</div><div>+ void main()</div><div>+ {</div><div>+ cout &lt;&lt; &quot;Hello World!&quot; &lt;&lt; endl;</div><div>
+ cout &lt;&lt; &quot;Welcome to C++ Programming&quot; &lt;&lt; endl;</div><div>+ }&#39;</div><div>&gt; </div><div>&gt; fx &lt;- cxxfunction(src,plugin = &quot;Rcpp&quot;,verbose=T)</div><div> &gt;&gt; setting environment variables: </div>
<div>PKG_LIBS =  C:/R/Rsoft/library/Rcpp/lib/i386/libRcpp.a</div><div><br></div><div> &gt;&gt; LinkingTo : Rcpp</div><div>CLINK_CPPFLAGS =  -I&quot;C:/R/Rsoft/library/Rcpp/include&quot; </div><div><br></div><div> &gt;&gt; Program source :</div>
<div><br></div><div>   1 : </div><div>   2 : // includes from the plugin</div><div>   3 : </div><div>   4 : #include &lt;Rcpp.h&gt;</div><div>   5 : </div><div>   6 : </div><div>   7 : #ifndef BEGIN_RCPP</div><div>   8 : #define BEGIN_RCPP</div>
<div>   9 : #endif</div><div>  10 : </div><div>  11 : #ifndef END_RCPP</div><div>  12 : #define END_RCPP</div><div>  13 : #endif</div><div>  14 : </div><div>  15 : using namespace Rcpp;</div><div>  16 : </div><div>  17 : </div>
<div>  18 : // user includes</div><div>  19 : </div><div>  20 : </div><div>  21 : // declarations</div><div>  22 : extern &quot;C&quot; {</div><div>  23 : SEXP file3a1c304e( ) ;</div><div>  24 : }</div><div>  25 : </div><div>
  26 : // definition</div><div>  27 : </div><div>  28 : SEXP file3a1c304e(  ){</div><div>  29 : BEGIN_RCPP</div><div>  30 : </div><div>  31 : END_RCPP</div><div>  32 : }</div><div>  33 : </div><div>  34 : </div><div>Compilation argument:</div>
<div> C:/R/Rsoft/bin/i386/R CMD SHLIB file3a1c304e.cpp 2&gt; file3a1c304e.cpp.err.txt </div><div>g++ -I&quot;C:/R/Rsoft/include&quot;    -I&quot;C:/R/Rsoft/library/Rcpp/include&quot;      -O2 -Wall  -c file3a1c304e.cpp -o file3a1c304e.o</div>
<div>g++ -shared -s -static-libgcc -o file3a1c304e.dll tmp.def file3a1c304e.o C:/R/Rsoft/library/Rcpp/lib/i386/libRcpp.a -LC:/R/Rsoft/bin/i386 -lR</div><div>cygwin warning:</div><div>  MS-DOS style path detected: C:/R/Rsoft/etc/i386/Makeconf</div>
<div>  Preferred POSIX equivalent is: /cygdrive/c/R/Rsoft/etc/i386/Makeconf</div><div>  CYGWIN environment variable option &quot;nodosfilewarning&quot; turns off this warning.</div><div>  Consult the user&#39;s guide for more details about POSIX paths:</div>
<div>    <a href="http://cygwin.com/cygwin-ug-net/using.html#using-pathnames">http://cygwin.com/cygwin-ug-net/using.html#using-pathnames</a></div><div>Error in as.function.default(c(value, if (is.null(bd) || is.list(bd)) list(bd) else bd),  : </div>
<div>  invalid formal argument list for &quot;function&quot;</div></div></div></div><div><br></div><div><font class="Apple-style-span" color="#ff0000">Here, I also tried the test by Hadley,</font></div><div><br></div><div>
<div>_devel()</div><div>cygwin warning:</div><div>  MS-DOS style path detected: C:/R/Rsoft/etc/i386/Makeconf</div><div>  Preferred POSIX equivalent is: /cygdrive/c/R/Rsoft/etc/i386/Makeconf</div><div>  CYGWIN environment variable option &quot;nodosfilewarning&quot; turns off this warning.</div>
<div>  Consult the user&#39;s guide for more details about POSIX paths:</div><div>    <a href="http://cygwin.com/cygwin-ug-net/using.html#using-pathnames">http://cygwin.com/cygwin-ug-net/using.html#using-pathnames</a></div>
<div>gcc -I&quot;C:/R/Rsoft/include&quot;    -I&quot;C:/R/Rsoft/library/Rcpp/include&quot;      -O3 -Wall  -std=gnu99 -c foo.c -o foo.o</div><div>gcc -shared -s -static-libgcc -o foo.dll tmp.def foo.o C:/R/Rsoft/library/Rcpp/lib/i386/libRcpp.a -LC:/R/Rsoft/bin/i386 -lR</div>
<div>[1] TRUE</div></div><div><br></div><div>Sorry that I don&#39;t really get it how to rebuild R packages from source.</div><div><br></div>Thanks,<div><br></div><div>Kent<br><br><div class="gmail_quote">On Thu, Oct 13, 2011 at 5:11 PM, Hadley Wickham <span dir="ltr">&lt;<a href="mailto:hadley@rice.edu">hadley@rice.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">&gt; My best guess is that you have not installed the Rtools correctly.  Can you<br>
&gt; compile a simple &#39;hello, world&#39; example in C or C++?  Can you rebuild R<br>
&gt; packages from source?<br>
<br>
</div>I wrote an function to check that you have a valid R development<br>
environment (with help from Simon Urbanek) for devtools.  See code<br>
below - and check with has_devel()<br>
<br>
Hadley<br>
<br>
<br>
has_devel &lt;- function() {<br>
  foo_path &lt;- file.path(tempdir(), &quot;foo.c&quot;)<br>
<br>
  cat(&quot;void foo(int *bar) { *bar=1; }\n&quot;, file = foo_path)<br>
  on.exit(unlink(foo_path))<br>
<br>
  R(&quot;CMD SHLIB foo.c&quot;, tempdir())<br>
  dylib &lt;- file.path(tempdir(), paste(&quot;foo&quot;, .Platform$dynlib.ext, sep=&#39;&#39;))<br>
  on.exit(unlink(dylib), add = TRUE)<br>
<br>
  dyn.load(dylib)<br>
  on.exit(dyn.unload(dylib), add = TRUE)<br>
<br>
  stopifnot(do.call(&quot;.C&quot;, list(&quot;foo&quot;,0L))[[1]] == 1L)<br>
  TRUE<br>
}<br>
<br>
R &lt;- function(options, path = tempdir()) {<br>
  r_path &lt;- shQuote(file.path(R.home(&quot;bin&quot;), &quot;R&quot;))<br>
  in_dir(path, system_check(paste(r_path, options)))<br>
}<br>
<br>
system_check &lt;- function(cmd) {<br>
  res &lt;- system(cmd)<br>
  if (res != 0) {<br>
    stop(&quot;Command failed (&quot;, res, &quot;)&quot;, call. = FALSE)<br>
  }<br>
  invisible(TRUE)<br>
}<br>
<br>
in_dir &lt;- function(dir, code) {<br>
  cur &lt;- getwd()<br>
  setwd(dir)<br>
  on.exit(setwd(cur))<br>
<br>
  force(code)<br>
}<br>
<font color="#888888"><br>
--<br>
Assistant Professor / Dobelman Family Junior Chair<br>
Department of Statistics / Rice University<br>
<a href="http://had.co.nz/" target="_blank">http://had.co.nz/</a><br>
</font><div><div></div><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br></div>