0

Am trying to multiply two small matrices but i cant get the code to compile

#include <iostream>
#include <armadillo>


using namespace std;
using namespace arma;



int main()
{


mat A1(1,2) ;
A1.ones();
mat Theta1(6,1);
Theta1.randn();
mat tool = trans(Theta1);
mat z1= tool*A1;
//cout<<z1<<endl;
cout<<Theta1<<endl;
}

I get the following errors

||=== Build: Debug in tutorialpp (compiler: GNU GCC Compiler) ===| obj\Debug\main.o||In function ZN4arma4blas4gemvIdEEvPKcPKiS5_PKT_S8_S5_S8_S5_S8_PS6_S5_':| D:\Downloads\armadillo-7.200.1b\armadillo-7.200.1b\include\armadillo_bits\wrapper_blas.hpp|36|undefined reference towrapper_dgemv_'| obj\Debug\main.o||In function ZN4arma4blas4gemmIdEEvPKcS3_PKiS5_S5_PKT_S8_S5_S8_S5_S8_PS6_S5_':| D:\Downloads\armadillo-7.200.1b\armadillo-7.200.1b\include\armadillo_bits\wrapper_blas.hpp|71|undefined reference towrapper_dgemm_'| ||error: ld returned 1 exit status| ||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 6 second(s)) ===|

Please guide me so i can fix this , thanks

Weather Vane
  • 33,872
  • 7
  • 36
  • 56
Konkovac
  • 41
  • 6
  • Undefined reference usually means the linker command is missing a library. Googling "undefined reference towrapper_dgemm_" dug up http://stackoverflow.com/questions/8978742/armadillo-blas-lapack-linking-error – user4581301 Jun 14 '16 at 20:24
  • ok , probably its a linking problem but how do i properly link armadillo with codeblocks i cant find a proper guide ,this is all new to me – Konkovac Jun 14 '16 at 20:36
  • Why would one want to link an unrelated object file to an IDE? Code::Blocks is not a library. It is also not a compiler or an linker. – too honest for this site Jun 14 '16 at 20:38
  • ok maybe a phrased it wrong , i just want to find out how i can make armadillo run properly while i use codeblocks to build the program. – Konkovac Jun 14 '16 at 20:45
  • 1
    Somewhere in Code::Blocks you will be able to set the list of libraries the linker will use. Googling "code::blocks linker libraries" finds: http://stackoverflow.com/questions/5862757/how-do-i-link-to-a-library-with-codeblocks which may or may not be accurate 5 years later, but probably will point you in the right direction. [Get yourself a reliable reference](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) you can consult for coding tips and proper terminology, and then use the terminology to make Internet searches. They're very handy. – user4581301 Jun 14 '16 at 20:56

0 Answers0