Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7014 Discussions

catastrophic error: cannot open source file "mkl.h"




I really really really have a hard time navigating this site. So sorry if the docs state it.


I'm trying to run the matrix multiplication example found at


I then installed Intel MKL and the Intel Parallel Studio XE. The only reason I installed the Studio was the icc compiler. I don't plan to use any IDE currently.


So I installed


Now if I cd into the directory for the example and use make I get:

$ make
icc -c src/dgemm_example.c -o release/dgemm_example.o
src/dgemm_example.c(27): catastrophic error: cannot open source file "mkl.h"
#include "mkl.h"

compilation aborted for src/dgemm_example.c (code 4)
make: *** [Makefile:26: release/dgemm_example.o] Error 4


I guess that's because there are no environment variables set. I tried to figure out how but e.g. the getting started guide for 2020 only points me to that "compilation command generator" tool. Which I don't need since i have a makefile.


So if I'm right with my assumption that I need to set env vars, which one do I need to set?


Also is it possible to use icc without all the IDE stuff? Or whatever is included in that Parallel Studio?



0 Kudos
2 Replies

>> Please set the mkl environments to your session by calling script.

e.x: source /opt/intel/compilers_and_libraries_2020/linux/mkl/bin/ intel64

>> then dotn’t forget to add the mkl Include file directory when you compile your test:

icc -c -IMKLROOT/Include dgemm_example.c -o release/dgemm_example.o


>> You may also try to check how to builf the examples ( mklroot/examples folder) where you may find out makefiles which help to build these examples with many of supported mkl's modes

>> and please check MKL Getting Started documentation to see all needed info

0 Kudos

This issue has been resolved and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only. 

0 Kudos