<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Dear all, I created a small example that reproduces my error below. It has to do with my use of module with  .constructor<const Rcpp::NumericVector &, int>() with Rcpp::NumericVector. I guess I’m not doing things the right way but since it is working on windows and used to work until now with my Mac … <div class=""><br class=""></div><div class="">Thanks in advance for your help (below the simple test and the error obtained) <br class=""><div class="">Regards</div><div class="">Robin</div><div class=""><div class=""><br class=""></div><div class=""><div class="">#include <Rcpp.h></div><div class="">using namespace Rcpp;</div><div class=""><br class=""></div><div class="">class MyModel</div><div class="">{</div><div class="">public:</div><div class="">  double a;</div><div class="">  ~MyModel();</div><div class="">  MyModel();</div><div class="">  MyModel(const Rcpp::NumericVector& ModelData, int temp);</div><div class="">};</div><div class=""><br class=""></div><div class="">RCPP_EXPOSED_CLASS(MyModel)</div><div class="">  </div><div class="">  MyModel::~MyModel() </div><div class="">  {}</div><div class="">MyModel::MyModel() : a(0) </div><div class="">{}</div><div class="">MyModel::MyModel(const Rcpp::NumericVector& ModelData, int temp) : a(0)</div><div class="">{}</div><div class=""><br class=""></div><div class="">RCPP_MODULE(MyModel){</div><div class="">  </div><div class="">  Rcpp::class_<MyModel>("MyModel")</div><div class="">  .constructor()</div><div class="">  .constructor<const Rcpp::NumericVector &, int>()</div><div class="">  ;</div><div class="">}</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Compilation error : </div><div class=""><br class=""></div><div class=""><pre tabindex="0" class="GD15MCFCEUB ace_text-layer GD15MCFCHUB GD15MCFCAW ace_line" style="font-variant-ligatures: normal; line-height: 1.45; outline: none; border: none; word-break: break-all; margin-top: 0px; margin-bottom: 0px; box-sizing: border-box; width: 632.6px; padding: 6px; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); font-family: Monaco, monospace !important; font-size: 10pt !important; font-variant-numeric: inherit !important; font-variant-east-asian: inherit !important; font-stretch: inherit !important; white-space: pre-wrap !important;"><span class="GD15MCFCEUB" style="outline: none; border: none; word-break: break-all; margin: 0px;">/usr/local/clang7/bin/clang++  -Wall -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -I"/Users/robin.girard/Documents/Code/Packages/test_modules/Test2/src" -I"/Users/robin.girard/Documents/Code/Packages/test_modules/Test2/src/../inst/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c test.cpp -o test.o
</span><span class=" ace_constant GD15MCFCEUB" style="outline: none; border: none; word-break: break-all; margin: 0px; color: rgb(197, 6, 11);">In file included from test.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/RcppCommon.h:168:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/as.h:25:
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/internal/Exporter.h:31:30: error: reference member 't' binds to a temporary object whose lifetime would be shorter than the lifetime of the constructed object
                    Exporter( SEXP x ) : t(x){}
                                           ^
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/as.h:87:41: note: in instantiation of member function 'Rcpp::traits::Exporter<const Rcpp::Vector<14, PreserveStorage> &>::Exporter' requested here
            ::Rcpp::traits::Exporter<T> exporter(x);
                                        ^
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/as.h:152:26: note: in instantiation of function template specialization 'Rcpp::internal::as<const Rcpp::Vector<14, PreserveStorage> &>' requested here
        return internal::as<T>(x, typename traits::r_type_traits<T>::r_category());
                         ^
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/module/Module_generated_Constructor.h:58:13: note: in instantiation of function template specialization 'Rcpp::as<const Rcpp::Vector<14, PreserveStorage> &>' requested here
            as<U0>(args[0]),
            ^
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/module/Module_generated_class_constructor.h:91:29: note: in instantiation of member function 'Rcpp::Constructor_2<MyModel, const Rcpp::Vector<14, PreserveStorage> &, int>::get_new' requested here
        AddConstructor( new Constructor_2<Class,U0,U1> , valid, docstring ) ;
                            ^
test.cpp:26:4: note: in instantiation of function template specialization 'Rcpp::class_<MyModel>::constructor<const Rcpp::Vector<14, PreserveStorage> &, int>' requested here
  .constructor<const Rcpp::NumericVector &, int>()
   ^
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/internal/Exporter.h:35:9: note: reference member declared here
                    T t ;</span></pre><div class=""><pre tabindex="0" class="GD15MCFCEUB ace_text-layer GD15MCFCHUB GD15MCFCAW ace_line" style="font-variant-ligatures: normal; line-height: 1.45; outline: none; border: none; word-break: break-all; margin-top: 0px; margin-bottom: 0px; box-sizing: border-box; width: 632.6px; padding: 6px; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); font-family: Monaco, monospace !important; font-size: 10pt !important; font-variant-numeric: inherit !important; font-variant-east-asian: inherit !important; font-stretch: inherit !important; white-space: pre-wrap !important;"><span class=" ace_constant GD15MCFCEUB" style="outline: none; border: none; word-break: break-all; margin: 0px; color: rgb(197, 6, 11);">1 error generated.
make: *** [test.o] Error 1
Error in Rcpp::sourceCpp("src/test.cpp") : 
  Error 1 occurred building shared library.</span></pre><div class=""><br class=""></div></div></div><div class=""><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">Le 3 mai 2019 à 08:41, Robin GIRARD <<a href="mailto:robin.girard@mines-paristech.fr" class="">robin.girard@mines-paristech.fr</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I found a way to solve my RcppArmadillo problem here <a href="https://stackoverflow.com/questions/51761599/cannot-find-stdio-h" class="">https://stackoverflow.com/questions/51761599/cannot-find-stdio-h</a><div class="">I don’t really understand what happened because I had the file. </div><div class="">The other error is still here</div><div class="">Regards</div><div class="">Robin<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">Le 3 mai 2019 à 08:32, Robin GIRARD <<a href="mailto:robin.girard@mines-paristech.fr" class="">robin.girard@mines-paristech.fr</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Dear Simon, <div class=""><br class=""></div><div class="">**regarding RcppArmadillo build from source pb**  the config.log is attached and points the following error while checking something about cross  compilation.<div class=""><div class="">In file included from conftest.cpp:9:</div><div class="">/usr/local/clang7/include/c++/v1/stdio.h:108:15: fatal error: 'stdio.h' file not found</div><div class="">#include_next <stdio.h></div><div class=""><br class=""></div><div class="">But this file exists. </div><div class=""><br class=""></div><div class="">** regarding my compilation error** it is obtained while trying to build the module file, when calling #include "Rcpp.h » (line 4 of file <span style="font-family: Monaco, monospace; font-size: 10pt; orphans: 2; white-space: pre-wrap; widows: 2; background-color: rgb(255, 255, 255);" class="">Client.hpp) </span></div><div class=""><pre tabindex="0" class="GD15MCFCEUB ace_text-layer GD15MCFCHUB GD15MCFCAW ace_line" style="font-variant-ligatures: normal; line-height: 1.45; outline: none; border: none; word-break: break-all; margin-top: 0px; margin-bottom: 0px; box-sizing: border-box; width: 502px; padding: 6px; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); font-family: Monaco, monospace !important; font-size: 10pt !important; font-variant-numeric: inherit !important; font-variant-east-asian: inherit !important; font-stretch: inherit !important; white-space: pre-wrap !important;"><span class="GD15MCFCEUB" style="outline: none; border: none; word-break: break-all; margin: 0px;">/usr/local/clang7/bin/clang++  -Wall -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -std=c++11 -I../inst/include/ -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c <a href="http://mod_client.cc/" class="">mod_client.cc</a> -o mod_client.o</span></pre><div class=""><br class=""></div></div><div class=""><pre tabindex="0" class="GD15MCFCEUB ace_text-layer GD15MCFCHUB GD15MCFCAW ace_line" style="font-variant-ligatures: normal; line-height: 1.45; outline: none; border: none; word-break: break-all; margin-top: 0px; margin-bottom: 0px; box-sizing: border-box; width: 502px; padding: 6px; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); font-family: Monaco, monospace !important; font-size: 10pt !important; font-variant-numeric: inherit !important; font-variant-east-asian: inherit !important; font-stretch: inherit !important; white-space: pre-wrap !important;"><span class="GD15MCFCEUB" style="outline: none; border: none; word-break: break-all; margin: 0px;">In file included from <a href="http://mod_client.cc/" class="">mod_client.cc</a>:1:
In file included from ../inst/include/Client.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/RcppCommon.h:168:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/as.h:25:
/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/internal/Exporter.h:31:30: error: reference member 't' binds to a temporary object whose lifetime would be shorter than the lifetime of the constructed object
                    Exporter( SEXP x ) : t(x){}</span></pre><div class=""><br class=""></div></div><div class="">Thanks in advance for your help</div><div class="">Regards</div><div class="">Robin</div><div class=""><br class=""></div><div class=""></div></div></div></div><span id="cid:FD9848EC-362B-4DA9-9AE5-7F66090C6BD5@persee.local" class=""><config.log></span><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">Le 2 mai 2019 à 23:18, Simon Urbanek <<a href="mailto:simon.urbanek@R-project.org" class="">simon.urbanek@R-project.org</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div class="">Robin,<br class=""><br class="">this is unlikely a Mac issue, merely newer compilers give you better error handling pointing to issues in the code that may not have been detected before. If you post the code we can have a look.<br class=""><br class="">Also check your tools - the RcppArmadillo error points out that your compiler setup is broken since it cannot create runnable executable. Check config.log for details.<br class=""><br class="">Cheers,<br class="">Simon<br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">On May 2, 2019, at 1:04 PM, Robin GIRARD <<a href="mailto:robin.girard@mines-paristech.fr" class="">robin.girard@mines-paristech.fr</a>> wrote:<br class=""><br class="">Dear all, avec a Mac update today I obtained the following error while compiling a package of mine using Rcpp : <br class="">/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/internal/Exporter.h:31:30: error: reference member 't' binds to a temporary object whose lifetime would be shorter than the lifetime of the constructed object<br class="">                    Exporter( SEXP x ) : t(x){}<br class=""><br class="">I’m pretty sure this has something to do with Mac, I updated the Command line tool, I manage to compile simple examples with sourceRcpp (trying to follow instructions here <a href="http://thecoatlessprofessor.com/programming/r-compiler-tools-for-rcpp-on-macos/" class="">http://thecoatlessprofessor.com/programming/r-compiler-tools-for-rcpp-on-macos/</a>) I’m still trying to reproduce my error on a simple example. <br class="">I have R 3.6 and clang7 installed. <br class=""><br class="">Another strange point (might be connected) is that when I try to install RcppArmadillo from source (as suggested in link above with install.packages("", type = "source »)) it gives something about cross compiling:<br class=""><br class="">checking whether the C++ compiler works... yes<br class="">checking for C++ compiler default output file name... a.out<br class="">checking for suffix of executables... <br class="">checking whether we are cross compiling... configure: error: in `/private/var/folders/zt/7cz1y9md79l_h08bbqymt4w9z8xlw7/T/Rtmpgi7WQZ/R.INSTALL4f4110aa3f/RcppArmadillo':<br class="">configure: error: cannot run C++ compiled programs.<br class="">If you meant to cross compile, use `--host'.<br class="">See `config.log' for more details<br class="">ERROR: configuration failed for package ‘RcppArmadillo’<br class=""><br class=""><br class="">Thanks in advance for your help<br class="">Regards<br class="">Robin<br class=""><br class=""><br class="">_______________________________________________<br class="">Rcpp-devel mailing list<br class=""><a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" class="">Rcpp-devel@lists.r-forge.r-project.org</a><br class=""><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" class="">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">Rcpp-devel mailing list<br class=""><a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" class="">Rcpp-devel@lists.r-forge.r-project.org</a><br class="">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</div></blockquote></div><br class=""></div></div></div></body></html>