Error using mex Unknown file extension ' '. Matlab Ubuntu

17 Ansichten (letzte 30 Tage)
Abdulllah
Abdulllah am 23 Okt. 2020
Bearbeitet: Walter Roberson am 26 Okt. 2020
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?

Antworten (1)

Walter Roberson
Walter Roberson am 26 Okt. 2020
Bearbeitet: Walter Roberson am 26 Okt. 2020
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

Kategorien

Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by