<div dir="ltr">Hi Dirk, <div><br></div><div>Thanks for the comments. Suppose if I were to go with your third suggestion, do you happen to have any examples of RcppArmadillo calling SEXP functions that I can refer to? </div>


<div><br></div><div>In the past, I tried (1) putting the set of MASS functions in a separate MASS.cpp file, (2) creating a header file MASS.h, and (3) making the main script file call the MASS functions by doing include "MASS.h". But the same errors were still present. </div>


<div><br></div><div>Thank you again for your help!</div><div><br></div><div>-Xiao</div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 3, 2014 at 9:52 PM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Xiao,<br>
<div><br>
On 3 September 2014 at 21:39, Xiao He wrote:<br>
| Hi Kevin, <br>
|<br>
| Yes, those extra includes are there because some functions taken from the MASS<br>
| package need these them.<br>
|<br>
| I rearranged the includes by placing #include <RcppArmadillo.h> before the ones<br>
| below, and was able to reduce the number of errors from 7 to 4. <br>
|<br>
| #include <R_ext/Linpack.h><br>
| #include <R_ext/Applic.h><br>
| #include <R_ext/Utils.h> <br>
|<br>
| Is it possible for you to take a look at the script below, which includes those<br>
| functions from MASS that require these includes? I am not sure what else needs<br>
| to be done. The errors seem to have to do with the fortran library. <br>
|<br>
| <a href="https://www.dropbox.com/s/ukjml693ta8r8gi/test2.cpp?dl=0" target="_blank">https://www.dropbox.com/s/ukjml693ta8r8gi/test2.cpp?dl=0</a><br>
<br>
</div>I just glanced at this for a few secs. Quick comments<br>
<br>
-- Remove R.h (pulled in via Rcpp which is pulled in from RcppArmadillo)<br>
<br>
-- think about using sort and QR from (Rcpp)Armadillo: because that is why we<br>
   use Armadillo for<br>
<br>
-- if you can't make the error go away in one file, create two files:<br>
   * one higher-level with RcppArmadillo calling<br>
   * another lower-level SEXP-only set of functions with the code you<br>
     borrowed from MASS<br>
<span><font color="#888888"><br>
Dirk<br>
<br>
--<br>
<a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a><br>
</font></span></blockquote></div><br></div></div>