<span style="font-family: Arial; font-size: 13px;">excellent ! this worked perfectly<div>thanks a lot<br><div><br>On Thursday, December 20, 2012 at 1:04 AM, "Romain Francois" <romain@r-enthusiasts.com> wrote:<blockquote style="border-left:solid 1px #ccc;margin-left:10px;padding-left:10px;">Welcome in macro hell.<br><br>Try this:<br><br>#include <gretl/libgretl.h><br>#include <gretl/kalman.h><br><br>#undef PARENT<br>#include <Rcpp.h><br><br>So one of these headers is defining a macro "PARENT" that conflicts with <br>the name PARENT used in any.h. This should take care of it.<br><br>Romain<br><br>Le 20/12/12 00:56, jean.p@hushmail.com a écrit :<br>> thanks for the quick reply!<br>><br>> first option did not change anything and second option seems to create<br>> new errors linked to Rcpp:<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>> In file included from<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/functions.h:34,<br>>                   from<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/sugar.h:30,<br>>                   from /usr/lib/R/library/Rcpp/include/Rcpp.h:68,<br>>                   from test2.cpp:4:<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/any.h:33:36: error:<br>> macro "PARENT" requires 2 arguments, but only 1 given<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/any.h:62:36: error:<br>> macro "PARENT" requires 2 arguments, but only 1 given<br>> In file included from<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/functions.h:35,<br>>                   from<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/sugar.h:30,<br>>                   from /usr/lib/R/library/Rcpp/include/Rcpp.h:68,<br>>                   from test2.cpp:4:<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/all.h:33:36: error:<br>> macro "PARENT" requires 2 arguments, but only 1 given<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/all.h:64:36: error:<br>> macro "PARENT" requires 2 arguments, but only 1 given<br>> In file included from<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/functions.h:34,<br>>                   from<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/sugar.h:30,<br>>                   from /usr/lib/R/library/Rcpp/include/Rcpp.h:68,<br>>                   from test2.cpp:4:<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/any.h: In<br>> constructor ‘Rcpp::sugar::Any<NA, T>::Any(const Rcpp::VectorBase<10,<br>> LHS_NA, LHS_T>&)’:<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/any.h:33: error:<br>> expected ‘(’ before ‘,’ token<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/any.h: In<br>> constructor ‘Rcpp::sugar::Any<false, T>::Any(const Rcpp::VectorBase<10,<br>> false, LHS_T>&)’:<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/any.h:62: error:<br>> expected ‘(’ before ‘,’ token<br>> In file included from<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/functions.h:35,<br>>                   from<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/sugar.h:30,<br>>                   from /usr/lib/R/library/Rcpp/include/Rcpp.h:68,<br>>                   from test2.cpp:4:<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/all.h: In<br>> constructor ‘Rcpp::sugar::All<NA, T>::All(const Rcpp::VectorBase<10,<br>> LHS_NA, LHS_T>&)’:<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/all.h:33: error:<br>> expected ‘(’ before ‘,’ token<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/all.h: In<br>> constructor ‘Rcpp::sugar::All<false, T>::All(const Rcpp::VectorBase<10,<br>> false, LHS_T>&)’:<br>> /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/all.h:64: error:<br>> expected ‘(’ before ‘,’ token<br>><br>><br>> On Thursday, December 20, 2012 at 12:48 AM, "Romain Francois"<br>> <romain@r-enthusiasts.com> wrote:<br>><br>>     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<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></div></span>