不能包含和链接OpenBLAS库(windows)



我正在尝试使用OpenBLAS库。我已经从http://sourceforge.net/projects/openblas/files/v0.2.14/下载了预编译的库OpenBLAS-v0.2.14-Win64-int64.zip。我把档案提取到我的C:目录。然后我试着运行这个简单的c程序:

#include <cblas.h>
#include <stdio.h>
void main()
{
    int i=0;
    double A[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0};         
    double B[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0};  
    double C[9] = {.5,.5,.5,.5,.5,.5,.5,.5,.5}; 
    cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans,3,3,2,1,A, 3, B, 3,2,C,3);
    for(i=0; i<9; i++){
        printf("%lf ", C[i]);}
    printf("n");
}

使用这个命令:

C:UsersMWAHAHADocumentsProgramas>x86_64-w64-mingw32-gcc -o hello -IC:OpenBLAS-v0.2.14-Win64-int64include -LC:OpenBLAS-v0.2.14-Win64-int64liblibopenblas -libopenblas  testeoblas.c

并得到以下消息:

C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -libopenblas
collect2.exe: error: ld returned 1 exit status

同样,如果我使用这个命令:

C:UsersMWAHAHADocumentsProgramas>x86_64-w64-mingw32-gcc -o hello -IC:OpenBLAS-v0.2.14-Win64-int64includes  testeoblas.c

I got this message:

testeoblas.c:1:19: fatal error: cblas.h: No such file or directory
compilation terminated.

我使用TDM-GCC-64编译器。这可能是非常基本的,但是我没有链接库的经验。我做错了什么?

我猜你已经设法从6年前开始编译了。不过,我将为将来寻求解决方案的人留下评论:

选项-I-L似乎不起作用。或者,可以定义$CPATH$LIBRARY_PATH变量,分别指向包含包含文件和库文件的文件夹。(至少在Linux上,这两种方法都可以工作)。

查看此博客文章

最新更新