I have the following problem. There is a need to install the mkl library (from there you need mainly lapack and blas to work with matrices and linear algebra). In fact, it does not matter that all this works in Visual Studio, if you can tell me where and how else, I will be grateful.
Actually, I downloaded the library from here: https://learn.microsoft.com/en-us/cognitive-toolkit/setup-mkl-on-windows and, it seems, I did all the necessary steps to install it: I added dll files to the project folder; in the project properties "C/C++ -> general -> Additional Include Directories" added the include folder from the installed archive; in "Linker -> general -> additional library directories" added the lib folder and in "Linker -> input -> additional dependencies" added 2 .lib files that were in the installed archive.
the following code:
#include <iostream>
#include <mkl.h>
int main()
{
char transa = 'N';
char transb = 'N';
int n = 2;
double alpha = 1.0;
const double mat[4] = { 1, 2, 3, 2 };
const double mat2[4] = { 2, 2, 2, 2 };
double res[4] = {};
DGEMM(&transa, &transb, &n, &n, &n, &alpha, mat, &n, mat2, &n, &alpha, res, &n);
return 0;
}
returns the LNK2019 error: unresolved external symbol _DGEMM referenced in function _main. please tell me what I did wrong. If there is an option to do it somewhere not in VS, it also suits, because the functionality of the libraries is needed in the near future
You can try it from the command prompt and the link line advisor https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html?wapkw=link%20line%20advisor suggests you what are the required options that are needed in order to compile and link the code.
If you want to make it work in Visual Studio, I suggest you download oneAPI Base toolkit https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html from where you can get the latest oneMKL.
During the installation of oneAPI Base toolkit it will automatically integrate the oneMKL to your VS 2019 thereby you just need to enable the /Qmkl option (unlike how you are adding the paths of header files and library files) in the
configuration properties > Intel Libraries for oneAPI > use oneMKL (select the required option from the dropdown)and then build your code.Here is a quick check from my end from the command prompt with the MSVC compiler and below is the command which has generated the .exe file successfully without any linking errors (here MKLROOT="C:\Program Files (x86)\Intel\oneAPI\mkl\2022.2.1\include")