[Rcpp-devel] #include gretl libraries in Rcpp

Romain Francois romain at r-enthusiasts.com
Thu Dec 20 00:47:46 CET 2012


The extern "C" looks suspicious. What happens if you don't include it ?

e.g.

#include <Rcpp.h>
#include <gretl/libgretl.h>
#include <gretl/kalman.h>

or perhaps:

#include <gretl/libgretl.h>
#include <gretl/kalman.h>
#include <Rcpp.h>

Romain

Le 20/12/12 00:39, jean.p at hushmail.com a écrit :
> Hi,
>
> I am having trouble getting Rcpp to compile c++ files including headers
> from the gretl statistical libraries
>
> for instance, here are the first lines of a test cpp file I have been
> trying to compile:
>
> #include <Rcpp.h>
>
> extern "C" {
> #include <gretl/libgretl.h>
> #include <gretl/kalman.h>
> }
>
> now, here is the result of a make command in linux (debian), with the
> error messages focussing on the lines of code where the #include are
> located:
>
> jean at desktop:~/Documents/code experiments/gretl$ make
>
> 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
>
> make[1]: Entering directory `/home/jean/Documents/code experiments/gretl'
>
> 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
>
> In file included from /usr/include/gretl/libgretl.h:384,
>                   from test2.cpp:4:
> /usr/include/gretl/genmain.h:33: error: expected identifier before
> numeric constant
> /usr/include/gretl/genmain.h:33: error: expected ‘}’ before numeric constant
> /usr/include/gretl/genmain.h:33: error: expected unqualified-id before
> numeric constant
> /usr/include/gretl/genmain.h:49: error: expected constructor,
> destructor, or type conversion before ‘;’ token
> /usr/include/gretl/genmain.h:59: error: ‘R_MAX’ was not declared in this
> scope
> test2.cpp:6: error: expected declaration before ‘}’ token
> make[1]: *** [test2.o] Error 1
> make[1]: Leaving directory `/home/jean/Documents/code experiments/gretl'
> make: *** [test2.o] Error 1
>
> any guidance would be really appreciated!
>
> many thanks,
> jean
>
>
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30

R Graph Gallery: http://gallery.r-enthusiasts.com

blog:            http://romainfrancois.blog.free.fr
|- http://bit.ly/RE6sYH : OOP with Rcpp modules
`- http://bit.ly/Thw7IK : Rcpp modules more flexible



More information about the Rcpp-devel mailing list