无法从'<brace-enclosed initializer =“”list =“”>'转换为'arma :: mat

时间:2015-10-09 03:35:56

标签: c++ c++11 gcc initializer-list armadillo

我只是从Armadillo矩阵库documentation复制粘贴来直接初始化矩阵对象:

#include <armadillo>

using namespace arma;

int main()
{
    mat A = { {1, 3, 5},
              {2, 4, 6} };
    A.print();
    return 0;
}

以下是我编译它的方式:

g++ -std=c++11 test.cpp -larmadillo

但我无法理解为什么会收到此错误:

test.cpp: In function ‘int main()’:
test.cpp:8:22: error: could not convert ‘{{1, 3, 5}, {2, 4, 6}}’ from ‘<brace-enclosed initializer list>’ to ‘arma::mat {aka arma::Mat<double>}’
            {2, 4, 6} };
                      ^

0 个答案:

没有答案