Problem in using the "-g" option of mex

I have written a MEX file which is successfully built by:
mex -v mymex.cpp
However, when I want to add the debug information using:
mex -v -g mymex.cpp
I get the following error
mymex.cpp(28) : fatal error C1083: Cannot open include file: 'mkl.h': Invalid argument
Could someone help me why mex cannot find mkl.h when I am using -g while it works perfectly when -g is not used? I need to do this to be able to debug my mex code. All the necessary header and library files are accurately defined in mexopts.bat. I don't know why these options does not work for mex -g and does work when I am not using -g option.

댓글 수: 2

Kaustubha Govind
Kaustubha Govind 2014년 6월 10일
Is mkl.h included only for debug builds via a pre-processor macro like NDEBUG?
AP
AP 2014년 6월 10일
편집: AP 2014년 6월 10일
I simply used #include "mkl.h" in my Mex code. "mkl.h" is the math kernel library provided by Intel. When I put the header file in the directory of the Mex file it does not complain. I have many header files from different software in my Mex file.

댓글을 달려면 로그인하십시오.

 채택된 답변

Dekun Pei
Dekun Pei 2014년 6월 16일

1 개 추천

Can you provide the compiler you are using the full verbose output by passing "-v" to mex. My guess is the directory containing mkl.h is not being passed as a include library directory. If your know where the header file is located, try manually pass it to mex with the "-I" flag such as :
mex -v -g mymex.cpp -I<header_directory>
Note that there is NO space between -I and the header directory you will provide. Also, if the directory has a space in it, you have to enclose it in single quotes.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

질문:

AP
2014년 6월 10일

답변:

2014년 6월 16일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by