Search code examples
c++g++armadillofedora-23

How can I run example armadillo program


I am trying to run the minimal armadillo example program (bellow for convinience)

#include <iostream>
#include <armadillo>

using namespace std;
using namespace arma;

int main()
  {
  mat A = randu<mat>(4,5);
  mat B = randu<mat>(4,5);
  cout << A*B.t() << endl; 
  return 0;
  }

I am running a linux fedora 23 distro and have the armadillo package installed.

$ sudo dnf list armadillo
Last metadata expiration check: 1:04:12 ago on Tue May 31 17:57:36 2016.
Installed Packages
armadillo.x86_64        6.700.6-1.fc23         @updates
Available Packages
armadillo.i686          6.700.6-1.fc23         updates 

Though when I compiled the example program from the current directory I get:

$ g++ example.cpp -o example -O2 -larmadillo
example.cpp:2:21: fatal error: armadillo: No such file or directory
compilation terminated.

Solution

  • On Fedora you also need to install the corresponding development package: armadillo-devel. This provides the header files required for compiling C++ programs that use armadillo.

    For example:

    sudo dnf install armadillo-devel