Armadillo library error

Hello,

I'm having some problems using Armadillo library..
I installed armadillo, lapack and blas by apt-get
apt-get install libblas-dev apt-get install liblapack-dev apt-get install libarmadillo-dev

And compile the codes like that
1
2
g++ -Wall -c test.cpp -O1 -larmadillo -llapack -lblas
g++ -Wall -o test test.o


I have no problems with basic codes like
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <armadillo>

 
using namespace std;
using namespace arma;
 
int main()
{
		mat m;
		vec eigval;
		m << 1 << 1 << endr
		  << 1 << 1 << endr;
		cout << m << endl;
 
  return 0;
}


But if I need to use some decomposition or factorisation (ex: eig_sym(eigval, m);)
i got the linker error:
undefined reference to `wrapper_cheev_'
Anyone can help me?
Last edited on
You need to add the libraries to your second line, where you are linking the program named 'test', not the first.

Also, you might rename your program: The command 'test' is already a command in Unix/Linux.
Topic archived. No new replies allowed.