<span style="font-family: Arial; font-size: 13px;">thanks for the quick reply!<div><br></div><div>first option did not change anything and second option seems to create new errors linked to Rcpp:</div><div><br></div><div><div>jean@desktop:~/Documents/code experiments/gretl$ make</div><div><br></div><div>PKG_CPPFLAGS="-I/usr/share/R/include -I/usr/lib/R/library/Rcpp/include -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  " PKG_LIBS="-L/usr/lib64/R/lib -lR -L/usr/lib/R/library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/lib/R/library/Rcpp/lib -fopenmp -lgretl-1.0 -lxml2 -lfftw3 -lm -lglib-2.0  " R CMD SHLIB test2.cpp</div><div><br></div><div>make[1]: Entering directory `/home/jean/Documents/code experiments/gretl'</div><div><br></div><div>g++ -I/usr/share/R/include -DNDEBUG -I/usr/share/R/include -I/usr/lib/R/library/Rcpp/include -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include       -fpic  -O3 -pipe  -g  -c test2.cpp -o test2.o</div><div>In file included from /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/functions.h:34,</div><div>                 from /usr/lib/R/library/Rcpp/include/Rcpp/sugar/sugar.h:30,</div><div>                 from /usr/lib/R/library/Rcpp/include/Rcpp.h:68,</div><div>                 from test2.cpp:4:</div><div>/usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/any.h:33:36: error: macro "PARENT" requires 2 arguments, but only 1 given</div><div>/usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/any.h:62:36: error: macro "PARENT" requires 2 arguments, but only 1 given</div><div>In file included from /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/functions.h:35,</div><div>                 from /usr/lib/R/library/Rcpp/include/Rcpp/sugar/sugar.h:30,</div><div>                 from /usr/lib/R/library/Rcpp/include/Rcpp.h:68,</div><div>                 from test2.cpp:4:</div><div>/usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/all.h:33:36: error: macro "PARENT" requires 2 arguments, but only 1 given</div><div>/usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/all.h:64:36: error: macro "PARENT" requires 2 arguments, but only 1 given</div><div>In file included from /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/functions.h:34,</div><div>                 from /usr/lib/R/library/Rcpp/include/Rcpp/sugar/sugar.h:30,</div><div>                 from /usr/lib/R/library/Rcpp/include/Rcpp.h:68,</div><div>                 from test2.cpp:4:</div><div>/usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/any.h: In constructor ‘Rcpp::sugar::Any<NA, T>::Any(const Rcpp::VectorBase<10, LHS_NA, LHS_T>&)’:</div><div>/usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/any.h:33: error: expected ‘(’ before ‘,’ token</div><div>/usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/any.h: In constructor ‘Rcpp::sugar::Any<false, T>::Any(const Rcpp::VectorBase<10, false, LHS_T>&)’:</div><div>/usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/any.h:62: error: expected ‘(’ before ‘,’ token</div><div>In file included from /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/functions.h:35,</div><div>                 from /usr/lib/R/library/Rcpp/include/Rcpp/sugar/sugar.h:30,</div><div>                 from /usr/lib/R/library/Rcpp/include/Rcpp.h:68,</div><div>                 from test2.cpp:4:</div><div>/usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/all.h: In constructor ‘Rcpp::sugar::All<NA, T>::All(const Rcpp::VectorBase<10, LHS_NA, LHS_T>&)’:</div><div>/usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/all.h:33: error: expected ‘(’ before ‘,’ token</div><div>/usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/all.h: In constructor ‘Rcpp::sugar::All<false, T>::All(const Rcpp::VectorBase<10, false, LHS_T>&)’:</div><div>/usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/all.h:64: error: expected ‘(’ before ‘,’ token</div><div><br></div><br>On Thursday, December 20, 2012 at 12:48 AM, "Romain Francois" <romain@r-enthusiasts.com> wrote:<blockquote style="border-left:solid 1px #ccc;margin-left:10px;padding-left:10px;">The extern "C" looks suspicious. What happens if you don't include it ?<br><br>e.g.<br><br>#include <Rcpp.h><br>#include <gretl/libgretl.h><br>#include <gretl/kalman.h><br><br>or perhaps:<br><br>#include <gretl/libgretl.h><br>#include <gretl/kalman.h><br>#include <Rcpp.h><br><br>Romain<br><br>Le 20/12/12 00:39, jean.p@hushmail.com a écrit :<br>> Hi,<br>><br>> I am having trouble getting Rcpp to compile c++ files including headers<br>> from the gretl statistical libraries<br>><br>> for instance, here are the first lines of a test cpp file I have been<br>> trying to compile:<br>><br>> #include <Rcpp.h><br>><br>> extern "C" {<br>> #include <gretl/libgretl.h><br>> #include <gretl/kalman.h><br>> }<br>><br>> now, here is the result of a make command in linux (debian), with the<br>> error messages focussing on the lines of code where the #include are<br>> located:<br>><br>> jean@desktop:~/Documents/code experiments/gretl$ make<br>><br>> PKG_CPPFLAGS="-I/usr/share/R/include -I/usr/lib/R/library/Rcpp/include<br>> -I/usr/include/libxml2 -I/usr/include/glib-2.0<br>> -I/usr/lib/glib-2.0/include  " PKG_LIBS="-L/usr/lib64/R/lib -lR<br>> -L/usr/lib/R/library/Rcpp/lib -lRcpp<br>> -Wl,-rpath,/usr/lib/R/library/Rcpp/lib -fopenmp -lgretl-1.0 -lxml2<br>> -lfftw3 -lm -lglib-2.0  " R CMD SHLIB test2.cpp<br>><br>> make[1]: Entering directory `/home/jean/Documents/code experiments/gretl'<br>><br>> g++ -I/usr/share/R/include -DNDEBUG -I/usr/share/R/include<br>> -I/usr/lib/R/library/Rcpp/include -I/usr/include/libxml2<br>> -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include       -fpic  -O3<br>> -pipe  -g  -c test2.cpp -o test2.o<br>><br>> In file included from /usr/include/gretl/libgretl.h:384,<br>>                   from test2.cpp:4:<br>> /usr/include/gretl/genmain.h:33: error: expected identifier before<br>> numeric constant<br>> /usr/include/gretl/genmain.h:33: error: expected ‘}’ before numeric constant<br>> /usr/include/gretl/genmain.h:33: error: expected unqualified-id before<br>> numeric constant<br>> /usr/include/gretl/genmain.h:49: error: expected constructor,<br>> destructor, or type conversion before ‘;’ token<br>> /usr/include/gretl/genmain.h:59: error: ‘R_MAX’ was not declared in this<br>> scope<br>> test2.cpp:6: error: expected declaration before ‘}’ token<br>> make[1]: *** [test2.o] Error 1<br>> make[1]: Leaving directory `/home/jean/Documents/code experiments/gretl'<br>> make: *** [test2.o] Error 1<br>><br>> any guidance would be really appreciated!<br>><br>> many thanks,<br>> jean<br>><br>><br>> _______________________________________________<br>> Rcpp-devel mailing list<br>> Rcpp-devel@lists.r-forge.r-project.org<br>> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>><br><br><br>-- <br>Romain Francois<br>Professional R Enthusiast<br>+33(0) 6 28 91 30 30<br><br>R Graph Gallery: <a href="http://gallery.r-enthusiasts.com">http://gallery.r-enthusiasts.com</a><br><br>blog:            <a href="http://romainfrancois.blog.free.fr">http://romainfrancois.blog.free.fr</a><br>|- <a href="http://bit.ly/RE6sYH">http://bit.ly/RE6sYH</a> : OOP with Rcpp modules<br>`- <a href="http://bit.ly/Thw7IK">http://bit.ly/Thw7IK</a> : Rcpp modules more flexible</blockquote></div></span>