gcc 4.2.1链接问题:ATLAS 3.8.3

时间:2014-05-09 17:12:55

标签: gcc osx-snow-leopard blas atlas

我试图使用CBLAS ATLAS。我是初学者。我有以下C代码。

// tmp.cpp file
#include<stdio.h>
#include<stdlib.h>
#include<cblas.h>

int main(void){
   float x[2] = {6,2};
   float *y = (float *)malloc(2*sizeof(float));
   const int n = 2;
   const int incx = 1;
   const int incy = 1;
   float a = 5.4;
   y[0] = 4.2; y[1] = 4.5;
   cblas_saxpy(n,a,x,incx,y,incy);
   free(y);
}

我在视频http://youtu.be/DvLSr6zN0pU?t=6m5s和下一个视频&#34; part3&#34;之后安装了ATLAS库。但是,我没有FORTRAN编译器,因此我配置了

$ .. / ATLAS / confiugre --nof77

安装过程如视频中所述。

iMac:Desktop sotero$ ls /usr/local/atlas/include
atlas       cblas.h     clapack.h
iMac:Desktop sotero$ ls /usr/local/atlas/lib/
libatlas.a  libcblas.a  liblapack.a libptcblas.a

我尝试使用此结果进行编译

iMac:Desktop sotero$ c++ tmp.cpp
tmp.cpp:3:18: error: cblas.h: No such file or directory
tmp.cpp: In function ‘int main()’:
tmp.cpp:14: error: ‘cblas_saxpy’ was not declared in this scope

我阅读了如何建立网站http://math-atlas.sourceforge.net/errata.html#LINK的链接,我有以下内容进行编译

iMac:Desktop sotero$ c++ tmp.cpp -L/usr/local/atlas/lib/ -lcblas -latlas -I/usr/local/atlas/include/
Undefined symbols:
  "cblas_saxpy(int, float, float const*, int, float*, int)", referenced from:
     _main in ccPop12J.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

我不知道应该如何编译。我只需要一级BLAS。如果你链接到ATLAS库,我一直在寻找编译,但我迷路了。

我该如何解决?

0 个答案:

没有答案