Visual Studio mkl_link_tool.exe 链接错误

Visual Studio mkl_link_tool.exe linking error

我正在尝试在我新安装的 Microsoft Visual Studio 2019 和 Intel Parallel Studio XE(随 MKL 库 2020 一起提供)中编译一个非常简单的 C++ 代码。基本上,代码以 CSR 格式创建一个 3x3 稀疏单位矩阵句柄,然后销毁句柄:

#include "mkl.h"
#include "mkl_spblas.h"
int main(void)
{
    const MKL_INT n = 3;
    MKL_INT ia[3] = {0, 1, 2},ja[3] = {0, 1, 2};
    double a[3] = {1., 1., 1. };
    sparse_matrix_t csrA; 
    mkl_sparse_d_create_csr(&csrA, SPARSE_INDEX_BASE_ZERO, n, n, ia, ia + 1, ja, a);
    mkl_sparse_destroy(csrA);
    return;
}

我做了 this link (as well as this link) 描述的配置项目(步骤 6 除外,因为我在 Visual Studio 中找不到“自定义构建设置”,所以我在“自定义构建步骤").

我使用 Intel Math Kernel Library Link Line Advisor 配置包含目录和库目录(我选择了 MS C\C++ 编译器、Intel(R)64 架构、动态链接、32 位整数接口和顺序线程层)。

感谢@john,我取得了一些小进步。但我仍然收到此错误:

Error   MSB3073 The command "mkl_link_tool.exe -libs -c ms_c -a intel64 -i ilp64 -p no 2> NUL" exited with code 9009.   ConsoleApplication1 C:\Program Files (x86)\Microsoft Visual Studio19\Community\MSBuild\Microsoft\VC\v160\Platforms\x64\PlatformToolsets\v142\ImportBefore\Intel.Libs.MKL.v142.targets    64      

我以前在 linux 系统下成功 运行 一些代码调用 MKL 库,但我对 MSVS(以及 MKL)还是很陌生,所以我真的很感激任何帮助.我在互联网上阅读了一些类似的主题(例如,),但仍然无法完成工作。

mkl forum:https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-2020-1-VS2019-linking-bug/m-p/1153138

上讨论了同样的问题