[cpp11] "does not name a type"

I am using the cpp11 package (not available as a topic tag) to invoke C++ code from R, but I get an odd compilation error.

My C++ code simply calls a function from a library, and passes the result back to R as is. The data type I am returning is an R data type, so my R code imports arrow as well as my C++ code (I am hoping that by importing the arrow library in R first, it will already be able to handle the data type being returned).

However, the compilation of the C++ code produces an error, thinking the "arrow namespace" is trying to name a type. Can someone help me understand why this is?

For my R code:



For my C++ code:

#include "cpp11.hpp"

// Other includes

R_GetReaderForKey(cpp11::r_string table_key);

I get the following error:

/tmp/RtmpTCOCmO/file354a4ad33ec6/src/cpp11.cpp:4:1: error: ‘arrow’ does not name a type
 arrow::Result<BatchStreamRdrPtr> R_GetReaderForKey(cpp11::r_string table_key);
/tmp/RtmpTCOCmO/file354a4ad33ec6/src/cpp11.cpp: In function ‘SEXPREC* _skyteth_r_R_GetReaderForKey(SEXP)’:
/tmp/RtmpTCOCmO/file354a4ad33ec6/src/cpp11.cpp:7:27: error: ‘R_GetReaderForKey’ was not declared in this scope
     return cpp11::as_sexp(R_GetReaderForKey(cpp11::as_cpp<cpp11::decay_t<cpp11::r_string>>(table_key)));

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.