1
我最近設法構建並運行了一個簡單的CLAPACK Microsoft Visual Studio 2008項目(從http://icl.cs.utk.edu/lapack-for-windows/lapack/index.html下載)。之後,在LAPACK dgesv_ call之後插入一行以初始化另一個整數tempInteger會導致不成功的構建。錯誤是:CLAPACK-EXAMPLE.c(30):錯誤C2143:語法錯誤:缺少';'在「類型」之前。看起來LAPACK函數的執行阻止了某些動作,例如之後的變量初始化。任何人都可以幫助我瞭解發生了什麼並解決它?提前致謝。代碼清單如下:調用CLAPACK函數後初始化變量
#include < stdio.h>
#include "f2c.h"
#include "clapack.h"
int main(void)
{
/* 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;
int qqq = 1;
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);
int tempInteger = 1;
return info;
}