LAPACK Archives

[Lapack] have irritating link error when linking with LAPACK with Vistua

Dear Lake,
did you try building directly the libraries?
You just have to download LAPACK and build it using cmake.
Julie
On Sep 15, 2011, at 11:08 AM, da wang wrote:

Oh, a little additional info: I am using Win7 on 64 bit machine so I use your 
x64 version. But I even tried your win32 version, still the same link error. 
Did I miss any step to compile with LAPACK in Windows? Thanks a lot.
 
Lake

From: da wang <dawang2002@Domain.Removed>
To: "lapack@Domain.Removed" <lapack@Domain.Removed>
Sent: Thursday, September 15, 2011 10:05 AM
Subject: have irritating link error when linking with LAPACK with Vistual 
Studio

Dear Sir/Madam,
 
I am very interested in using your LAPACK for Windows to do some calculation. 
However, from your website, I followed all your instructions to use LAPACK 
with your sample code, but always get below link error:
 
1>------ Build started: Project: linkWithLAPACK, Configuration: Debug Win32 
------
1>Build started 9/15/2011 9:50:39 AM.
1>InitializeBuildStatus:
1> Touching "Debug\linkWithLAPACK.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>linkWithLAPACK.obj : error LNK2019: unresolved external symbol _dgesv_ 
referenced in function _wmain
1>C:\R&D Example\linkWithLAPACK\Debug\linkWithLAPACK.exe : fatal error 
LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.74
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
My code is directly copied from your website and made the change to use 
extern "C" per your instruction:
 
// linkWithLAPACK.cpp : Defines the entry point for the console application.
//
#include
"stdafx.h"
//#include < stdio.h>
extern
"C" void dgesv_(const int *N, const int *nrhs, double *A, const int *lda, int
*ipiv,
double *b, const int *ldb, int *info);
/*extern "C"*/
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);
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]);
else
fprintf(stderr,
"dgesv_ fails %d\n", info);
?
return info;
//return 0;
}
 
And in Visual Studio 2010 Linker->General->Additional Library Directories, I 
add the full path to the directory containing your .lib files. In 
Linker->Input->Additional Dependencies, I add 
"BLASd.lib;LAPACKd.lib;%(AdditionalDependencies)" since I am making debug 
build with your debug version(even I changed to your no debug version, it's 
the same).
 
Everything is done according to the instruction in your website, but always 
get that link error. Really appreciate your guys help on this. Thanks a lot.
 
Lake
cell: (805)2026762
?


_______________________________________________
Lapack mailing list
Lapack@Domain.Removed
http://lists.eecs.utk.edu/mailman/listinfo/lapack

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://lists.eecs.utk.edu/mailman/private/lapack/attachments/20110919/d4f8b5a0/attachment-0001.html
 

<Prev in Thread] Current Thread [Next in Thread>


For additional information you may use the LAPACK/ScaLAPACK Forum.
Or one of the mailing lists, or