<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">Hi James and Bob,<div><br></div><div>I tried your suggestions and am attaching the output. I wasn't able to figure out how to run a vanilla R session, but I ran the commands in an R session without loading any packages and without any Rprofile.site or .Renviron files. I removed both the Rcpp and RcppArmadillo packages and reinstalled both from source. Then I ran the commands. </div><div><br></div><div>The following command evaluated successfully (and returned the value of "2"):</div><div><font face="monospace">Rcpp::evalCpp("1 + 1", verbose = TRUE)</font></div><div><br></div><div>The following command did not evaluate successfully and returned an error. I added "verbose = TRUE" to the command to provide the additional requested output:</div><div><font face="monospace">Rcpp::sourceCpp('/Users/itpetersen/Desktop/helloworld.cpp', verbose = TRUE)</font><br></div><div><br></div><div>Thanks very much for your help.</div><div>-Isaac</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 10, 2020 at 7:26 PM Balamuta, James Joseph <<a href="mailto:balamut2@illinois.edu">balamut2@illinois.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Isaac, <br>
<br>
To build off of what Bob mentioned, you may wish to check that Rcpp and RcppArmadillo are indeed installed.<br>
<br>
>From SO, we see:<br>
<br>
/Library/Frameworks/R.framework/Packages/RcppArmadillo/include/RcppArmadilloForward.h:26:10: fatal error: 'RcppCommon.h' file not found<br>
#include <RcppCommon.h><br>
^~~~~~~~~~~~~~<br>
<br>
helloworld.cpp:1:10: fatal error: 'RcppArmadillo.h' file not found<br>
#include <RcppArmadillo.h> <br>
<br>
Both statements are indicating that the header files for Rcpp and RcppArmadillo are not present on the system.<br>
<br>
Could you try this minimal compilation?<br>
<br>
install.packages("Rcpp", type = "source")<br>
Rcpp::evalCpp("1 + 1", verbose = TRUE)<br>
<br>
Best,<br>
<br>
JJB<br>
<br>
On 8/10/20, 7:00 PM, "R-SIG-Mac on behalf of Bob Rudis" <<a href="mailto:r-sig-mac-bounces@r-project.org" target="_blank">r-sig-mac-bounces@r-project.org</a> on behalf of <a href="mailto:bob@rud.is" target="_blank">bob@rud.is</a>> wrote:<br>
<br>
Something is causing Rcpp to be unable to detect the presence of {RcppArmadillo}, which can be seen in the lack of the include for it in the snippet you posted on SO (FWIW that site has multiple trackers and I'm not really a fan of being made a product to try to answer a question):<br>
<br>
clang++ <br>
-mmacosx-version-min=10.13 \<br>
-std=gnu++11 \<br>
-I"/Library/Frameworks/R.framework/Resources/include" \<br>
-DNDEBUG \<br>
-I"/Library/Frameworks/R.framework/Packages/Rcpp/include" \<br>
-I"/Users/itpetersen/Desktop" \<br>
-I/usr/local/include \<br>
-fPIC -Wall -g -O2 -c helloworld.cpp -o helloworld.o<br>
<br>
<br>
Can you re-run the sourceRcpp() call with `verbose = TRUE` and paste the output here?<br>
<br>
Also, have you tried:<br>
<br>
remove.packages(c("Rcpp", "RcppArmadillo"))<br>
install.packages(c("Rcpp", "RcppArmadillo"))<br>
<br>
and trying everything again in a `--vanilla` R session?<br>
<br>
> On Aug 10, 2020, at 18:33, Isaac Petersen <<a href="mailto:isaac-t-petersen@uiowa.edu" target="_blank">isaac-t-petersen@uiowa.edu</a>> wrote:<br>
> <br>
> I'm trying to compile C++ code in R so I can install packages from source.<br>
> I’m running R 4.0.2 on Mac OS X Catalina (10.15.6). I receive an error<br>
> when trying to compile C++ code in R. I posted the full details of my<br>
> problem on Stack Overflow here:<br>
> <a href="https://stackoverflow.com/questions/63276265/error-compiling-c-code-in-r-4-0-on-mac-os-x-catalina?noredirect=1#comment112012438_63276265" rel="noreferrer" target="_blank">https://stackoverflow.com/questions/63276265/error-compiling-c-code-in-r-4-0-on-mac-os-x-catalina?noredirect=1#comment112012438_63276265</a>.<br>
> The question was unfortunately marked as a duplicate because it is similar<br>
> to another question, even though the answers to the "similar" question did<br>
> not solve my problem. One responder noted that<br>
> "/usr/local/include/RcppArmadillo.h" was missing (even though I<br>
> successfully installed the RcppArmadillo package). Any help would be<br>
> greatly appreciated.<br>
> <br>
> Thanks very much in advance.<br>
> -Isaac<br>
> <br>
> ---<br>
> Isaac T. Petersen, Ph.D.<br>
> Assistant Professor<br>
> Department of Psychological and Brain Sciences<br>
> University of Iowa<br>
> 175 Psychological and Brain Sciences Building<br>
> Iowa City, IA 52242<br>
> p: (319) 467-1014<br>
> <a href="mailto:isaac-t-petersen@uiowa.edu" target="_blank">isaac-t-petersen@uiowa.edu</a><br>
> <a href="https://psychology.uiowa.edu/developmental-psychopathology-lab" rel="noreferrer" target="_blank">https://psychology.uiowa.edu/developmental-psychopathology-lab</a><br>
> <br>
> [[alternative HTML version deleted]]<br>
> <br>
> _______________________________________________<br>
> R-SIG-Mac mailing list<br>
> <a href="mailto:R-SIG-Mac@r-project.org" target="_blank">R-SIG-Mac@r-project.org</a><br>
> <a href="https://stat.ethz.ch/mailman/listinfo/r-sig-mac" rel="noreferrer" target="_blank">https://stat.ethz.ch/mailman/listinfo/r-sig-mac</a><br>
<br>
_______________________________________________<br>
R-SIG-Mac mailing list<br>
<a href="mailto:R-SIG-Mac@r-project.org" target="_blank">R-SIG-Mac@r-project.org</a><br>
<a href="https://stat.ethz.ch/mailman/listinfo/r-sig-mac" rel="noreferrer" target="_blank">https://stat.ethz.ch/mailman/listinfo/r-sig-mac</a><br>
<br>
</blockquote></div>