How to solve linker error in matrix multiplication in c using lapack library?

Posted by Malar on Stack Overflow See other posts from Stack Overflow or by Malar
Published on 2012-10-26T04:58:22Z Indexed on 2012/10/26 5:00 UTC
Read the original article Hit count: 222

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;

}

© Stack Overflow or respective owner

Related posts about c

    Related posts about visual-c++