Hello,
I would like to include the `Eigen::Tensor` library in some TMB model code. I am getting compiler errors when I include the header, I believe due to namespace clashes with TMB.
If I include `TMB.hpp` before `Tensor`:
```
#include <TMB.hpp>
#include <unsupported/Eigen/CXX11/Tensor>
```
I get the following error:
```
explicit specialization of non-template struct 'Rf_eval'
struct eval<Tensor<_Scalar, NumIndices_, Options, IndexType_>, Eigen::Dense>
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:1555:16: note: expanded from macro
'eval'
#define eval Rf_eval
^
```
If I include `Tensor` before `TMB`, I get the error:
```
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:106:3: error:
reference to 'array' is ambiguous
TYPEDEFS(scalartype_);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:15:9: note:
expanded from macro 'TYPEDEFS'
typedef array<scalartype> arraytype
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
```
Does anyone have experience with this? Is there a correct way to specify this or a workaround?
Below is example code and console output.
Many thanks,
Jeff
-----
```
library(TMB)
library(RcppEigen)
code1 <- '
#include <TMB.hpp>
#include <unsupported/Eigen/CXX11/Tensor>
//
template<class Type>
Type objective_function<Type>::operator() ()
{
PARAMETER(p);
Type val(p*p);
return val;
}
'
f1 <- tempfile(fileext = ".cpp")
writeLines(code1, f1)
TMB::compile(f1, flags = "-w")
code2 <- '
#include <unsupported/Eigen/CXX11/Tensor>
#include <TMB.hpp>
//
template<class Type>
Type objective_function<Type>::operator() ()
{
PARAMETER(p);
Type val(p*p);
return val;
}
'
f2 <- tempfile(fileext = ".cpp")
writeLines(code2, f2)
TMB::compile(f2, flags = "-w")
```
Output:
```
> library(RcppEigen)
> code1 <- '
+ #include <TMB.hpp>
+ #include <unsupported/Eigen/CXX11/Tensor>
+ //
+ template<class Type>
+ Type objective_function<Type>::operator() ()
+ {
+ PARAMETER(p);
+ Type val(p*p);
+ return val;
+ }
+ '
> f1 <- tempfile(fileext = ".cpp")
> writeLines(code1, f1)
> TMB::compile(f1, flags = "-w")
Note: Using Makevars in /Users/jeff/.R/Makevars
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include -I/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include -DTMB_SAFEBOUNDS -DLIB_UNLOAD=R_unload_file11d00690ca7aa -DTMB_LIB_INIT=R_init_file11d00690ca7aa -I/usr/local/include -fPIC -w -c /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d00690ca7aa.cpp -o /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d00690ca7aa.o
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d00690ca7aa.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/Tensor:99:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:122:8: error:
explicit specialization of non-template struct 'Rf_eval'
struct eval<Tensor<_Scalar, NumIndices_, Options, IndexType_>, Eigen::Dense>
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:1555:16: note: expanded from macro
'eval'
#define eval Rf_eval
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d00690ca7aa.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/Tensor:99:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:128:70: error:
template argument for non-type template parameter must be an expression
struct eval<const Tensor<_Scalar, NumIndices_, Options, IndexType_>, Eigen::Dense>
^~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:121:32: note:
template parameter is declared here
template<typename _Scalar, int NumIndices_, int Options, typename IndexType_>
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:134:72: error:
template argument for non-type template parameter must be an expression
struct eval<TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>, Eigen::Dense>
^~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:121:32: note:
template parameter is declared here
template<typename _Scalar, int NumIndices_, int Options, typename IndexType_>
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:140:78: error:
template argument for non-type template parameter must be an expression
struct eval<const TensorFixedSize<Scalar_, Dimensions, Options, IndexType_>, Eigen::Dense>
^~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:121:32: note:
template parameter is declared here
template<typename _Scalar, int NumIndices_, int Options, typename IndexType_>
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:146:63: error:
template argument for non-type template parameter must be an expression
struct eval<TensorMap<PlainObjectType, Options, MakePointer>, Eigen::Dense>
^~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:121:32: note:
template parameter is declared here
template<typename _Scalar, int NumIndices_, int Options, typename IndexType_>
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:152:69: error:
template argument for non-type template parameter must be an expression
struct eval<const TensorMap<PlainObjectType, Options, MakePointer>, Eigen::Dense>
^~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:121:32: note:
template parameter is declared here
template<typename _Scalar, int NumIndices_, int Options, typename IndexType_>
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:158:41: error:
template argument for non-type template parameter must be an expression
struct eval<TensorRef<PlainObjectType>, Eigen::Dense>
^~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:121:32: note:
template parameter is declared here
template<typename _Scalar, int NumIndices_, int Options, typename IndexType_>
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:164:47: error:
template argument for non-type template parameter must be an expression
struct eval<const TensorRef<PlainObjectType>, Eigen::Dense>
^~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:121:32: note:
template parameter is declared here
template<typename _Scalar, int NumIndices_, int Options, typename IndexType_>
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d00690ca7aa.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/Tensor:108:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h:95:51: error:
template argument for non-type template parameter must be an expression
struct eval<TensorCwiseUnaryOp<UnaryOp, XprType>, Eigen::Dense>
^~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:121:32: note:
template parameter is declared here
template<typename _Scalar, int NumIndices_, int Options, typename IndexType_>
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d00690ca7aa.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/Tensor:108:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h:101:65: error:
too few template arguments for class template 'Rf_eval'
struct nested<TensorCwiseUnaryOp<UnaryOp, XprType>, 1, typename eval<TensorCwiseUnaryOp<U...
^
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:1555:16: note: expanded from macro
'eval'
#define eval Rf_eval
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:122:8: note:
template is declared here
struct eval<Tensor<_Scalar, NumIndices_, Options, IndexType_>, Eigen::Dense>
^
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:1555:16: note: expanded from macro
'eval'
#define eval Rf_eval
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d00690ca7aa.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/Tensor:108:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h:101:110: error:
expected a qualified name after 'typename'
...XprType>, 1, typename eval<TensorCwiseUnaryOp<UnaryOp, XprType> >::type>
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h:101:110: error:
unknown type name 'type'
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h:171:68: error:
template argument for non-type template parameter must be an expression
struct eval<TensorCwiseBinaryOp<BinaryOp, LhsXprType, RhsXprType>, Eigen::Dense>
^~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:121:32: note:
template parameter is declared here
template<typename _Scalar, int NumIndices_, int Options, typename IndexType_>
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d00690ca7aa.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/Tensor:108:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h:177:82: error:
too few template arguments for class template 'Rf_eval'
struct nested<TensorCwiseBinaryOp<BinaryOp, LhsXprType, RhsXprType>, 1, typename eval<Ten...
^
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:1555:16: note: expanded from macro
'eval'
#define eval Rf_eval
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:122:8: note:
template is declared here
struct eval<Tensor<_Scalar, NumIndices_, Options, IndexType_>, Eigen::Dense>
^
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:1555:16: note: expanded from macro
'eval'
#define eval Rf_eval
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d00690ca7aa.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/Tensor:108:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h:177:144: error:
expected a qualified name after 'typename'
...1, typename eval<TensorCwiseBinaryOp<BinaryOp, LhsXprType, RhsXprType> >::type>
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h:177:144: error:
unknown type name 'type'
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h:248:85: error:
template argument for non-type template parameter must be an expression
struct eval<TensorCwiseTernaryOp<TernaryOp, Arg1XprType, Arg2XprType, Arg3XprType>, Eigen::Dense>
^~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:121:32: note:
template parameter is declared here
template<typename _Scalar, int NumIndices_, int Options, typename IndexType_>
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d00690ca7aa.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/Tensor:108:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h:254:99: error:
too few template arguments for class template 'Rf_eval'
...Arg1XprType, Arg2XprType, Arg3XprType>, 1, typename eval<TensorCwiseTernaryOp<TernaryOp, ...
^
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:1555:16: note: expanded from macro
'eval'
#define eval Rf_eval
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h:122:8: note:
template is declared here
struct eval<Tensor<_Scalar, NumIndices_, Options, IndexType_>, Eigen::Dense>
^
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:1555:16: note: expanded from macro
'eval'
#define eval Rf_eval
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d00690ca7aa.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/Tensor:108:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h:254:178: error:
expected a qualified name after 'typename'
...eval<TensorCwiseTernaryOp<TernaryOp, Arg1XprType, Arg2XprType, Arg3XprType> >::type>
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [/var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d00690ca7aa.o] Error 1
Error in TMB::compile(f1, flags = "-w") : Compilation failed
> code2 <- '
+ #include <unsupported/Eigen/CXX11/Tensor>
+ #include <TMB.hpp>
+ //
+ template<class Type>
+ Type objective_function<Type>::operator() ()
+ {
+ PARAMETER(p);
+ Type val(p*p);
+ return val;
+ }
+ '
> f2 <- tempfile(fileext = ".cpp")
> writeLines(code2, f2)
> TMB::compile(f2, flags = "-w")
Note: Using Makevars in /Users/jeff/.R/Makevars
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include -I/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include -DTMB_SAFEBOUNDS -DLIB_UNLOAD=R_unload_file11d0018d3c187 -DTMB_LIB_INIT=R_init_file11d0018d3c187 -I/usr/local/include -fPIC -w -c /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp -o /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.o
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:106:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/tmbutils_extra.hpp:32:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:106:3: error:
reference to 'array' is ambiguous
TYPEDEFS(scalartype_);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:15:9: note:
expanded from macro 'TYPEDEFS'
typedef array<scalartype> arraytype
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:106:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/tmbutils_extra.hpp:32:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:254:3: error:
reference to 'array' is ambiguous
TYPEDEFS(scalartype_);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:15:9: note:
expanded from macro 'TYPEDEFS'
typedef array<scalartype> arraytype
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:106:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/tmbutils_extra.hpp:32:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:296:3: error:
reference to 'array' is ambiguous
TYPEDEFS(scalartype_);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:15:9: note:
expanded from macro 'TYPEDEFS'
typedef array<scalartype> arraytype
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:106:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/tmbutils_extra.hpp:32:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:369:3: error:
reference to 'array' is ambiguous
TYPEDEFS(typename distribution::scalartype);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:15:9: note:
expanded from macro 'TYPEDEFS'
typedef array<scalartype> arraytype
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:106:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/tmbutils_extra.hpp:32:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:489:3: error:
reference to 'array' is ambiguous
TYPEDEFS(scalartype_);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:15:9: note:
expanded from macro 'TYPEDEFS'
typedef array<scalartype> arraytype
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:106:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/tmbutils_extra.hpp:32:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:663:3: error:
reference to 'array' is ambiguous
TYPEDEFS(scalartype_);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:15:9: note:
expanded from macro 'TYPEDEFS'
typedef array<scalartype> arraytype
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:106:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/tmbutils_extra.hpp:32:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:733:5: error:
reference to 'array' is ambiguous
array<scalartype> y(x,dim);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:106:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/tmbutils_extra.hpp:32:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:822:3: error:
reference to 'array' is ambiguous
TYPEDEFS(scalartype_);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:15:9: note:
expanded from macro 'TYPEDEFS'
typedef array<scalartype> arraytype
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:106:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/tmbutils_extra.hpp:32:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:950:3: error:
reference to 'array' is ambiguous
TYPEDEFS(typename distribution::scalartype);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:15:9: note:
expanded from macro 'TYPEDEFS'
typedef array<scalartype> arraytype
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:106:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/tmbutils_extra.hpp:32:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:1009:3: error:
reference to 'array' is ambiguous
TYPEDEFS(typename distribution::scalartype);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:15:9: note:
expanded from macro 'TYPEDEFS'
typedef array<scalartype> arraytype
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:106:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/tmbutils_extra.hpp:32:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:1096:3: error:
reference to 'array' is ambiguous
TYPEDEFS(typename distribution1::scalartype);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:15:9: note:
expanded from macro 'TYPEDEFS'
typedef array<scalartype> arraytype
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:106:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/tmbutils_extra.hpp:32:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:1287:3: error:
reference to 'array' is ambiguous
TYPEDEFS(typename distribution::scalartype);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/density.hpp:15:9: note:
expanded from macro 'TYPEDEFS'
typedef array<scalartype> arraytype
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:107:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/R_inla.hpp:100:3: error:
reference to 'array' is ambiguous
array<Type> Gtmp(n_tri,3,3);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
candidate found by name lookup is 'Eigen::array'
template <typename T, std::size_t N> using array = std::array<T, N>;
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/array.hpp:22:8: note:
candidate found by name lookup is 'tmbutils::array'
struct array:Map< Array<Type,Dynamic,1> >{
^
In file included from /var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.cpp:3:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/TMB.hpp:107:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmbutils/R_inla.hpp:100:3: error:
too few template arguments for alias template 'array'
array<Type> Gtmp(n_tri,3,3);
^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported/Eigen/CXX11/src/util/EmulateArray.h:229:38: note:
template is declared here
template <typename T, std::size_t N> using array = std::array<T, N>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
14 errors generated.
make: *** [/var/folders/fy/vmz3dx2x5bg1f8vy3z0yh5fr0000gn/T//RtmpdT8YYZ/file11d0018d3c187.o] Error 1
Error in TMB::compile(f2, flags = "-w") : Compilation failed
```
Session info:
```
> sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RcppEigen_0.3.3.9.1 TMB_1.7.18
loaded via a namespace (and not attached):
[1] compiler_4.0.4 Matrix_1.3-2 tools_4.0.4 Rcpp_1.0.6 grid_4.0.4 lattice_0.20-41
```