Page 1 of 1

undefined reference to cgeev_

PostPosted: Sun Jun 11, 2017 12:09 am
by nefarious
This is my first attempt at working with lapack and I don't seem be be understanding something.

I want to cal the function cgeev from a c++ program so I create a c extern signature:

struct Complex { double re; double im; };

extern "C" void cgeev_(char*, char*, int*, Complex*, int*, Complex*, Complex*, int*, Complex*, int*, Complex*, int*, float*, int*);

I then allocate the arguments and make the call
// Creates the rows of the matrix
Complex** In = new Complex*[40];
Complex** LEve = new Complex*[40];
Complex** REve = new Complex*[40];

// Creates the cols for the matrix
for (int i = 0; i < 40; i++)
In[i] = new Complex[40];
LEve[i] = new Complex[40];
REve[i] = new Complex[40];
Complex* Eigenvalues = new Complex[40];

int wl = 2 * 40;
Complex* WORK = new Complex[wl];
float* XWORK = new float[wl];
char leve = 'V';
char reve = 'V';
int N = 40;
int Lda = 40;
int aok = 0;
// char*, char*, int*, C*, int*, C*, C* int* C*, int*, C*. int*,
cgeev_(&leve, &reve, &N, (Complex*)In, &Lda, Eigenvalues, (Complex*)LEve, &Lda, (Complex*)REve, &Lda, WORK, &wl, XWORK, &aok);

And the linker complains:
3>CcmKEigenSpectrum.obj : error LNK2019: unresolved external symbol cgeev_ referenced in function "public: __cdecl CcmKEigenSpectrum::CcmKEigenSpectrum(void)" (??0CcmKEigenSpectrum@@QEAA@XZ)

I link to LAPACK.lib Is there something I forgot? More then likely something I have done wrong?

Re: undefined reference to cgeev_

PostPosted: Sun Jun 11, 2017 12:21 pm
by admin