mmar
May 19th, 2011, 11:26 AM
Hi!
I have just installed Lapack and Blas from Synaptic. I'm trying to compile this simple program:
#include <stdio.h>
#include <clapack.h>
#include <cblas.h>
void sgesv( int* n, int* nrhs, float* a, int* lda, int* ipiv, float* b, int* ldb, int* info );
int main()
{
int uno = 1;
int tres = 3;
float A [ ]={
2, 1, 1,
3, -1, 1,
0, 2, 3};
float x[ ]= {0, 0, 0};
float b [ ] = {1, 0, 3};
int ipiv[3];
int info;
int i;
sgesv (&tres, &uno, A, &tres, ipiv, b, &tres, &info);
for (i=0; i<3; ++i) printf("%f\n", x[i]);
return 0;
}But I get the following error: "undefinded reference to 'sgesv'" when I type "gcc lap.c -o lap -llapack -lblas"
I wrote another program that just uses BLAS and compiles fine with "gcc prueba.c -o prueba -lblas". However, this program using the
lapack routine returns an error. Have I missed anything? What am I doing wrong?
Thanks in advance
I have just installed Lapack and Blas from Synaptic. I'm trying to compile this simple program:
#include <stdio.h>
#include <clapack.h>
#include <cblas.h>
void sgesv( int* n, int* nrhs, float* a, int* lda, int* ipiv, float* b, int* ldb, int* info );
int main()
{
int uno = 1;
int tres = 3;
float A [ ]={
2, 1, 1,
3, -1, 1,
0, 2, 3};
float x[ ]= {0, 0, 0};
float b [ ] = {1, 0, 3};
int ipiv[3];
int info;
int i;
sgesv (&tres, &uno, A, &tres, ipiv, b, &tres, &info);
for (i=0; i<3; ++i) printf("%f\n", x[i]);
return 0;
}But I get the following error: "undefinded reference to 'sgesv'" when I type "gcc lap.c -o lap -llapack -lblas"
I wrote another program that just uses BLAS and compiles fine with "gcc prueba.c -o prueba -lblas". However, this program using the
lapack routine returns an error. Have I missed anything? What am I doing wrong?
Thanks in advance