I need to use cblas and clapack with Windows XP and Microsoft Visual Studio 2003 .net.
I've downloaded the package on http://www.netlib.org/clapack/CLAPACK3-Windows.zip. For one week I've been struggling with clapack and Visual Studio but without good results.
Here it the code that I have to build:
- Code: Select all
#include "stdafx.h"
#include "stdlib.h"
#define _USE_MATH_DEFINES
#include <math.h>
extern "C" {
#include "c:\...\clapack\f2c.h"
#include "c:\...\clapack\blaswrap.h"
#include "c:\...\clapack\cblas.h"
}
using namespace std;
void main()
{
double **A, **B;
int i, col, row;
const int m=2, p=3, n=2;
const double alpha = 1, beta = 0;
double *pA, *pB;
double *pC;
A = new double*[m];
//allocate memory for p cols
for (i = 0; i < m; ++i)
{
A[i] = new double[p];
};
// allocate memory for m rows
B = new double*[p];
//allocate memory for p cols
for (i = 0; i < p; ++i)
{
B[i] = new double[n];
};
for (row=0; row<m; row++)
{
for (col=0; col<p; col++)
{
A[row][col]=3*row+col+45;
cout << A[row][col] << " ";
}
cout << "\n";
}
cout << "\n";
for (row=0; row<p; row++)
{
for (col=0; col<m; col++)
{
B[row][col]=2*row+col;
cout << B[row][col] << " ";
}
cout << "\n";
}
cout << "\n";
pA = (double *) malloc(m * p * sizeof(double));
pB = (double *) malloc(p * n * sizeof(double));
pC = (double *) malloc(m * n * sizeof(double));
i=0;
for (row=0; row<m; row++)
{
for (col=0; col<p; col++)
{
//copy array into a row
pA[i] = *(*(A+row)+col);
i++;
}
}
cout << "\n";
i=0;
for (row=0; row<p; row++)
{
for (col=0; col<n; col++)
{
//copy array into a row
pB[i] = *(*(B+row)+col);
i++;
}
}
cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, m, p, n,
alpha, pA, m, pB, p, beta, pC, m);
}
These are the libraries that I've added to my C++ console application code:
libF77.lib
libI77.lib
blas.lib
clapack.lib
I don't understand why, but I've got the following error during linking:
cblas_dgemm_fcn error LNK2019: unresolved external symbol _cblas_dgemm referenced in function _main
cblas_dgemm_fcn fatal error LNK1120: 1 unresolved externals
Is there anyone who can help me to solve this problem?
Thank you in advance to anyone who would like to answer to this topic.
Kind regards,
Cristian
P.S. I rebuilt the blas and lapack libraries with my Visual Studio .net. Even using these new files I've got the error above....

