Dear All, first of all thanks again for Rcpp, I am becoming more and more dependent on it and I am filling my directories with .cpp scripts...
I have a Rcpp package P using some header file F.hpp in its src/ directory. This file F.hpp contains templated functions and structs. Is there a way for a new Rcpp package Q to include file F.hpp? I read already Writing R Extensions "Linking to native routines in other packages" as well as Rcpp-attriibutes, "Providing a C++ Interface". It looks like there are two mechanisms for sharing c++ code. 1. The "interface" mechanism: the real code is in the src/ directory but it is referred to from some headers in the inst/include directory. Additionally, these headers need to be wrapped with some (boilerplate and obscure to me) C code. This works only with functions. The boilerplate code can be nicely generated automatically with Rcpp attributes. 2. The "direct" mechanism: just put the code in inst/include and tweak the Makevars so that the compiler knows where to look for those headers. This should work also with structs and templated cpp code. I think I need the "direct" mechanism. In package P, I moved my hpp files in inst/include and tweaked the Makevars, the package compiled fine. Now in package Q I am trying to use some of the stuff, and I am including the files I need. I also did the following: 1. put import(P) in Q's namespace file 2. put Import P and LinkingTo P in Q's description file however during compilation I got an error like: undefined symbol: _Z16rcpp_hello_worldv do you know what could be wrong? Thanks a lot and sorry for bothering. Ale -- Alessandro Mammana, PhD Student Max Planck Institute for Molecular Genetics Ihnestraße 63-73 D-14195 Berlin, Germany _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel