Error using mex Unknown file extension ' '. Matlab Ubuntu
17 次查看(过去 30 天)
显示 更早的评论
Please help me compiling mex file in Matlab 2018b Ubuntu20. I get
Error using mex
Unknown file extension ' '.
The compiler setup compiler is g++, as can be seen in the command window. The header files and libs are located in the two folders defined as path1 and path2. The code for mex commpilations is
path1 = '/usr/local/include/OpenEXR/';
path2 = '/usr/local/lib/';
mex ('/mnt/D/D/ZJU Data/HDR/softwre/MatlabEXR/exrinfo.cpp', path1,path2)
Why do I get the unknown file extension error?
0 个评论
回答(1 个)
Walter Roberson
2020-10-26
编辑:Walter Roberson
2020-10-26
mex does not accept directory names as individual arguments: it thinks you are specifying files to be compiled and then complains when it cannot find the file extension.
It looks to me as if what you need is
mex('/mnt/D/D/ZJU Data/HDR/softwre/MatlabEXR/exrinfo.cpp', sprintf('-I"%s"', path1), sprintf('-L"%s"', path2))
In practice you could get away without the double quotes for these particular paths, but since directory names are permitted to include spaces and shell delimiter characters, it is safer to use them.
... though in theory you should use apostrophes instead of double-quotes, just in case the paths include some $ that might lead to unwanted shell variable interpolation
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!