필터 지우기
필터 지우기

Mex 'include' path merged with working directory path

조회 수: 10 (최근 30일)
John Anderson
John Anderson 2019년 2월 8일
댓글: Walter Roberson 2019년 2월 8일
I am attempting to compile a mex function. For some reason, the 'include' path I specify gets merged into my current working directory path. I don't recall seeing this before, although I spend most of my time in Linux and am working short-term on a Windows machine.
Below is the error message I get. Note that the line that is cited in error has the correct path but it is somehow interpreted to the wrong path.
Error using mex
C:\Users\john.anderson\Documents\MATLAB_Toolboxes\KWtools\TestPost\Matlab_mexa64\source\Files\Altair\2017\hm\include\ not found;
check that you are in the correct current folder, and check the spelling of
'C:\Users\john.anderson\Documents\MATLAB_Toolboxes\KWtools\TestPost\Matlab_mexa64\source\Files\Altair\2017\hm\include\'.
Error in makemex64 (line 30)
mex -v CC=g++ -O -DSNPRINTF=snprintf -IC:\Program Files\Altair\2017\hm\include\ ./RunHyper.c ...

채택된 답변

Walter Roberson
Walter Roberson 2019년 2월 8일
mex -v CC=g++ -O -DSNPRINTF=snprintf -IC:\Program Files\Altair\2017\hm\include\ ./RunHyper.c ...
means
mex ...
-v ...
CC=g++ ...
-O ...
-DSNPRINTF=snprintf ...
-IC:\Program ...
Files\Altair\2017\hm\include\ ...
./RunHyper.c ...
where each of those is a separate input argument.
The space in the directory name is confusing it.
You should be using
-I"C:\Program Files\Altair\2017\hm\include\"
but since some of that part is automatically generated, it sometimes is not worth fighting it to force it to generate quotes at the proper places. Much of the time it turns out to be easier to move include directories and libraries to paths that do not include spaces (or non-ANSII characters for that matter.)
  댓글 수: 2
John Anderson
John Anderson 2019년 2월 8일
Ah, yes. Those pesky blanks in Windows directory names. Another reason I usually dwell in Linux. I put my stuff in a directory without spaces in the path and it works fine now. Thanks for your help!
Walter Roberson
Walter Roberson 2019년 2월 8일
Linux is even worse, with / and null being the only characters forbidden in a filename -- but Linux shell script programmers have been burned often enough that they routinely put in quotes.
No, it turns out that mex.m is badly programmed, and although it accepts separated arguements, it slams tokens together into one long character vector and system()'s it, without bothering to put in protective quotes where appropriate :( :(

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by