我试图使用armadillo(更具体地说,armadillo-7.200.2)编译一些简单的程序。例如,我最简单的是在犰狳网站上给出的例子
#include<iostream>
#include<armadillo>
using namespace std;
using namespace arma;
int main()
{
mat A = randu<mat>(4,5);
mat B = randn<mat>(4,5);
return 0;
}
我用
编译 g++ example1.cpp -o example1 -O2 -larmadillo
我得到的错误消息(每次尝试)都是
In file included from /usr/local/include/armadillo:154:0,
from example1.cpp:2:
/usr/local/include/armadillo_bits/Mat_bones.hpp:759:26: error: no members matching ‘arma::Mat<eT>::operator=’ in ‘class arma::Mat<eT>’
using Mat<eT>::operator=;
^
/usr/local/include/armadillo_bits/Mat_bones.hpp:760:27: error: no members matching ‘arma::Mat<eT>::operator()’ in ‘class arma::Mat<eT>’
using Mat<eT>::operator();
^
In file included from /usr/local/include/armadillo:155:0,
from example1.cpp:2:
/usr/local/include/armadillo_bits/Col_bones.hpp:202:27: error: no members matching ‘arma::Col<eT>::operator()’ in ‘class arma::Col<eT>’
using Col<eT>::operator();
^
In file included from /usr/local/include/armadillo:156:0,
from example1.cpp:2:
/usr/local/include/armadillo_bits/Row_bones.hpp:200:27: error: no members matching ‘arma::Row<eT>::operator()’ in ‘class arma::Row<eT>’
using Row<eT>::operator();
^
In file included from /usr/local/include/armadillo:157:0,
from example1.cpp:2:
/usr/local/include/armadillo_bits/Cube_bones.hpp:418:27: error: no members matching ‘arma::Cube<eT>::operator=’ in ‘class arma::Cube<eT>’
using Cube<eT>::operator=;
^
/usr/local/include/armadillo_bits/Cube_bones.hpp:419:28: error: no members matching ‘arma::Cube<eT>::operator()’ in ‘class arma::Cube<eT>’
using Cube<eT>::operator();
^
我只能找到这些类型的错误消息的一个实例:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=680931
我尝试过多个编译选项,包括使用-I和-L来包含相关的文件和库,并包括推荐的标志,如-O1,-O2等,我总是得到同样的错误。我首先使用
安装了犰狳 brew install armadillo
我已经卸载了,一旦我无法到达任何地方并尝试使用cmake重新安装(我也使用自制软件安装)以及armadillo README.txt文件中给出的确切说明。对于我尝试编译的包含armadillo的任何程序,自制软件和cmake安装都会给出上面的错误消息。
我能想到的最好的东西是我使用的编译器(或者其他东西没有更新),这是
g++ (GCC) 4.8.0 20120603
其他一些信息 - 我使用的是OSX El Capitan 10.11.5。
有什么想法吗?