mex error for path names with spaces
조회 수: 6 (최근 30일)
이전 댓글 표시
I'm running Matlab R2016b (no, I can't upgrade it, that's what my employer is licensed for) on Windows, and trying to use mex to compile a c++ script I was given. I need to include MySQL in the compile, and I'm trying to do so as follows:
mex <my script> -I'C:\Program Files\MySQL\MySQL Server 8.0\include\' -L'C:\Program Files\MySQL\MySQL Server 8.0\lib' -lmysqlclient
I get the following error:
Building with 'MinGW64 Compiler (C++)'.
Error using mex
g++: error: Files\MATLAB\R2016b/extern/include -IC:\Program: Invalid argument
g++: error: Files\MATLAB\R2016b/simulink/include -fexceptions -fno-omit-frame-pointer -std=c++11 -O -DNDEBUG
C:\Users\marina\ZooScanDatabase_scripts_GUI_access_09Jun2021_R2016b\mysql.cpp -o
C:\Users\marko\AppData\Local\Temp\mex_71592438356584_12624\mysql.obj : No such file or directory
g++: fatal error: no input files
compilation terminated.
It looks like mex is having problems with the spaces in the path names I'm giving to -I and -L. I tried different combinations of single and double qotes, as well as no quotes at all, but nothing works. Is there a way to get around this?
댓글 수: 1
Jan
2021년 9월 23일
"I tried different combinations of single and double quotes"
It is useful to post, what you have tried. Then the readers do not have to post this again.
채택된 답변
Marina Frants
2021년 9월 24일
댓글 수: 3
Walter Roberson
2021년 9월 27일
mex('mysql.cpp',...
'-I"C:\Program Files\MySQL\MySQL Server 8.0\include\"',...
'-L"C:\Program Files\MySQL\MySQL Server 8.0\lib\"',...
'-llibmysql')
추가 답변 (2개)
Jan
2021년 9월 23일
Try this:
mex('<my script>', '-I"C:\Program Files\MySQL\MySQL Server 8.0\include\"', ...
'-L"C:\Program Files\MySQL\MySQL Server 8.0\lib"', '-lmysqlclient')
Steven Lord
2021년 9월 23일
Wrap all the text inputs that can contain spaces in single quotes.
disp 'Hello world!' % Equivalent of disp('Hello world!')
fprintf '%s \t%s\n' 'abracadabra' 'hocus pocus' % fprintf('%s \t%s\n', 'abracadabra', 'hocus pocus')
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!