Lapack linking problem for VS 2010 C++ 64bit app

Post here if you have a question about linking your program with LAPACK or ScaLAPACK library

Lapack linking problem for VS 2010 C++ 64bit app

Postby stlearner » Tue May 29, 2012 3:25 pm

I have created a C++ program with MS Visual Studio C++ 2010 configured to be 64bit application using the sample codes and precompiled blas and lapack libs and dlls (64bit) provided at I also configured the project properties by adding the libs and their directory to the link properties to make sure VS links them. The codes can be compiled without any problem. However, when I tried to build (link) the project it gives me the error:

error LNK2019: unresolved external symbol dgesv_ referenced in function main

On the other hand, I am able to build the corresponding exe application under 32bit version successfully.

So can anybody help me figure out what the problem is.

Thanks in advance.

BTW, here is the sample code I used for test:

#include "stdafx.h"

#include < stdio.h>

#ifdef __cplusplus
extern "C" {

void dgesv_(const int *N, const int *nrhs, double *A, const int *lda, int
*ipiv, double *b, const int *ldb, int *info);

void dgels_(const char *trans, const int *M, const int *N, const int *nrhs,
double *A, const int *lda, double *b, const int *ldb, double *work,
const int * lwork, int *info);

#ifdef __cplusplus

int _tmain(int argc, _TCHAR* argv[])
/* 3x3 matrix A
* 76 25 11
* 27 89 51
* 18 60 32
double A[9] = {76, 27, 18, 25, 89, 60, 11, 51, 32};
double b[3] = {10, 7, 43};

int N = 3;
int nrhs = 1;
int lda = 3;
int ipiv[3];
int ldb = 3;
int info;

dgesv_(&N, &nrhs, A, &lda, ipiv, b, &ldb, &info);

if(info == 0) /* succeed */
printf("The solution is %lf %lf %lf\n", b[0], b[1], b[2]);
fprintf(stderr, "dgesv_ fails %d\n", info);

return info;
Posts: 1
Joined: Tue May 29, 2012 3:04 pm

Re: Lapack linking problem for VS 2010 C++ 64bit app

Postby kevin1234 » Fri Jun 15, 2012 4:10 pm

Are you referencing the collection of freely available and freely distributable Windows header files here? Or are you having trouble wit h the import libraries files combined with GNU toolsets? As far as I know these Windows programs do not rely on any 3rd-party C runtime DLLs. :?
Posts: 1
Joined: Fri Jun 15, 2012 1:42 pm

Re: Lapack linking problem for VS 2010 C++ 64bit app

Postby darthbaker » Thu Jun 21, 2012 5:57 pm

I am having this exact problem (with different lapack functions ssyevd)

I have added the libraries to link with my x64 visual studio 2010 project and created the prototype function.

However It cannot find the external symbol _ssyevd.

Posts: 1
Joined: Thu Jun 21, 2012 5:50 pm

Return to Linking Problem

Who is online

Users browsing this forum: No registered users and 1 guest