user3199900
user3199900

Reputation: 141

Error when using library "xtensor-blas" in C++

I have been trying to use the xtensor-blas library for a while, but with no luck. I'm using Windows, G++ 8.1.0 and MinGW-W64. Here is my attempt at a simple example:

#include <iostream>
#include "xtensor/xarray.hpp"
#include "xtensor-blas/xlinalg.hpp"

int main()
{
    xt::xarray<double> a = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
    auto d = xt::linalg::det(a);
}

Here is the error I get

C:\Users\giafc\AppData\Local\Temp\cc498kqV.o:try_xtensor.cpp:(.text$_ZN9cxxlapack5getrfIiEET_S1_S1_PdS1_PS1_[_ZN9cxxlapack5getrfIiEET_S1_S1_PdS1_PS1_]+0x3f): undefined reference to `dgetrf_'
collect2.exe: error: ld returned 1 exit status

Here is the command line I issue to compile the file, where I include the Lapack header directory, I link the Lapack library (where libcblas.a is located), I include the xtensor header directory, the xtl header directory and the xtensor-blas header directory.

g++ try2_xtensor.cpp -std=c++14 -I C:/Users/giafc/Anaconda3/pkgs/lapack-3.6.1-h8933c1f_2/Library/include -L C:/Users/giafc/Anaconda3/pkgs/lapack-3.6.1-h8933c1f_2/Library/lib -lcblas -I C:/Users/giafc/Anaconda3/pkgs/xtensor-0.21.5-h7ef1ec2_0/Library/include -I C:/Users/giafc/Anaconda3/pkgs/xtl-0.6.13-h1ad3211_0/Library/include -I C:/Users/giafc/Anaconda3/pkgs/xtensor-blas-0.17.2-hd41736c_0/Library/include

Any ideas please?

Upvotes: 2

Views: 538

Answers (1)

mmarah
mmarah

Reputation: 83

With vcpkg you can easily install openblas and link against it.

Upvotes: 2

Related Questions