<div dir="ltr">Thank you <font color="#000000">Iñaki,</font><div><font color="#000000"><br></font></div><div><font color="#000000">that was the missing part. The package compiles now. </font></div><div><font color="#000000"><br></font></div><div><font color="#000000">I removed the RcppExports.cpp and called Rcpp::compileAttributes(). Together with the removal of useDynLib(nloptC) from NAMESPACE compilation succeeded. </font></div><div><font color="#000000"><br></font></div><div><font color="#000000">Again many thanks. </font></div><div><font color="#000000"><br></font></div><div><font color="#000000">Simon</font></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Mi., 18. Aug. 2021 um 17:28 Uhr schrieb Iñaki Ucar <<a href="mailto:iucar@fedoraproject.org">iucar@fedoraproject.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, 18 Aug 2021 at 16:37, Simon Zehnder<br>
<<a href="mailto:simon.zehnder@googlemail.com" target="_blank">simon.zehnder@googlemail.com</a>> wrote:<br>
><br>
> Hi folks,<br>
><br>
> apologies, if I am double posting - I had problems with my mail.<br>
><br>
> I need some help here from experienced Rcpp developers.<br>
><br>
> I am coding since some time on an R-package using Rcpp and nlopt. Lately I found out that I could probably use 'nloptr' to include nlopt in my C++ code, which would give a great advantage to users of my package (instead of installing nlopt on their systems by hand).<br>
> I followed the example on <a href="https://github.com/jchiquet/RcppArmadilloNLoptExample" rel="noreferrer" target="_blank">https://github.com/jchiquet/RcppArmadilloNLoptExample</a> (the nloptC one) and modified my code accordingly. When I compile my package I get the error<br>
><br>
> " Error: package or namespace load failed for ‘finmix’ in library.dynam(lib, package, package.lib):<br>
>  shared object ‘nloptC.so’ not found"<br>
><br>
> In my DESCRIPTION I use in the 'Imports' and the 'LinkingTo' field 'nloptr'. In my NAMESPACE I load 'nloptC' via 'useDynLib(nloptC)'.<br>
<br>
Remove this. The example has useDynLib(nloptC) because the package is<br>
called nloptC. Your package is called finmix, so you just need<br>
useDynLib(finmix) in the NAMESPACE.<br>
<br>
> What I saw in the example's 'RcppExports.cpp' file is<br>
><br>
> RcppExport void R_init_nloptC(DllInfo *dll) {<br>
>     R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);<br>
>     R_useDynamicSymbols(dll, FALSE);<br>
> }<br>
<br>
You have R_init_finmix instead, same reason as above.<br>
<br>
-- <br>
Iñaki Úcar<br>
</blockquote></div>