gpt4 book ai didi

c++ - 如何使 armadillo-5.200.1(+openblas 或 lapacke)与 visual studio 2010 一起工作?

转载 作者:太空宇宙 更新时间:2023-11-04 13:32:13 25 4
gpt4 key购买 nike

自一周以来,我一直在尝试使 armadillo-5.200.1 和 openblas(或 lapacke)与 visual studio 2010 一起工作,但我仍然有几个 Unresolved external symbol 错误与 blas 和 lapack 库中的函数有关。首先,我尝试从预构建的 Windows 二进制文件安装 openblas 并设置一个新项目并使用下面的示例代码对其进行测试:

#include <cblas.h>
#include <iostream>
#include <vector>

using namespace std;

int main()
{
blasint n = 10;
blasint in_x =1;
blasint in_y =1;

std::vector<double> x(n);
std::vector<double> y(n);

double alpha = 10;

std::fill(x.begin(),x.end(),1.0);
std::fill(y.begin(),y.end(),2.0);

cblas_daxpy( n, alpha, &x[0], in_x, &y[0], in_y);

//Print y
for(int j=0;j<n;j++)
std::cout << y[j] << "\t";

std::cout << std::endl;
}

我遇到了一个未解析的外部符号 « cblas_daxpy » 错误。我尝试使用 code::blocks 构建相同的项目并得到相同的错误。

我下载并设置了 msys 以便能够编译我在 github (https://github.com/xianyi/Openblas) 上下载的源代码,并试图让它在 code::blocks 和 visual studio 上工作,但我仍然遇到同样的错误。

然后我在自己的笔记本电脑上试了一下,因为它有 Linux ubuntu 14.04 LTS。因此,我克隆了 github 并编译了源代码,并尝试在另一个 code::blocks 项目中进行设置,我使用相同的示例代码对其进行了测试,但出现了有关 pthread_create 和 pthread_join 等函数的 undefined reference 错误。

我还尝试按照以下页面的说明使用 cmake 编译 lapacke 源代码:https://icl.cs.utk.edu/lapack-for-windows/lapack/ .我使用示例来测试项目构建是否正确,但是当我执行程序时,我有一个弹出窗口消息说找不到 liblapacke.dll。

为了将 openblas 与 visual studio 一起使用,我遵循了有关第三方库的说明:

add the location of the header files to "C/C++->Additional Include Directories"
add the .lib files to the "Linker->Input->Additional Dependencies"
add the location of the .lib files to "Linker->General->Additional Library Directories"

我需要至少在 Windows 7 上使用它,在 visual studio 2010 上更好,因为我们在工作中使用它。

最佳答案

你应该将dll文件复制到y的system32方向或Debug或Release文件夹

关于c++ - 如何使 armadillo-5.200.1(+openblas 或 lapacke)与 visual studio 2010 一起工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30977230/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com