I am running into an error when compiling the following C++ code:
# include <iostream>
# include <armadillo>
using namespace arma;
using namespace std;
int main() {
mat A;
mat B;
mat C;
// Populating the matrices with random numbers
A.randu(3,3);
B.randu(3,3);
// Matrix multiplication
C = A * B;
cout << "Mutliplying matrices A and B:" << endl;
cout << "A * B = " << C << endl;
return 0;
}
Here is my error when compiling with g++:
Undefined symbols for architecture x86_64: "_wrapper_dgemm_", referenced from:
void arma::blas::gemm<double>(char const*, char const*, int const*, > int const*, int const*, double const*, double const*, int const*, double > const*, int const*, double const*, double*, int const*) in >armadillo_playground-aa3649.o
"_wrapper_dgemv_", referenced from:
void arma::blas::gemv<double>(char const*, int const*, int const*, >double const*, double const*, int const*, double const*, int const*, >double const*, double*, int const*) in armadillo_playground-aa3649.o
ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see >invocation)
When I replace the matrix multiplication '*' with '+', '%', etc. the code compiles without complaint.
Thanks in advance!