How to solve linker error in matrix multiplication in c using lapack library?
- by Malar
I did Matrix multiplication using lapack library, I am getting an error like below. Can any one help me?
"error LNK2019: unresolved external symbol "void __cdecl dgemm(char,char,int *,int *,int *,double *,double *,int *,double *,int *,double *,double *,int *)" (?dgemm@@YAXDDPAH00PAN1010110@Z) referenced in function _main"
1..\bin\matrixMultiplicationUsingLapack.exe : fatal error LNK1120: 1 unresolved externals
I post my code below
# define matARowSize 2 // -- Matrix 1 number of rows
# define matAColSize 2 // -- Matrix 1 number of cols
# define matBRowSize 2 // -- Matrix 2 number of rows
# define matBColSize 2 // -- Matrix 2 number of cols
using namespace std;
void dgemm(char, char, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *);
int main()
{
double iMatrixA[matARowSize*matAColSize]; // -- Input matrix 1 {m x n}
double iMatrixB[matBRowSize*matBColSize]; // -- Input matrix 2 {n x k}
double iMatrixC[matARowSize*matBColSize]; // -- Output matrix {m x n * n x k = m x k}
double alpha = 1.0f;
double beta = 0.0f;
int n = 2;
iMatrixA[0] = 1;
iMatrixA[1] = 1;
iMatrixA[2] = 1;
iMatrixA[3] = 1;
iMatrixB[0] = 1;
iMatrixB[1] = 1;
iMatrixB[2] = 1;
iMatrixB[3] = 1;
//dgemm('N','N',&n,&n,&n,&alpha,iMatrixA,&n,iMatrixB,&n,&beta,iMatrixC,&n);
dgemm('N','N',&n,&n,&n,&alpha,iMatrixA,&n,iMatrixB,&n,&beta,iMatrixC,&n);
std::cin.get();
return 0;
}