Error using mex Unknown file extension ' '. Matlab Ubuntu

17 ビュー (過去 30 日間)
Abdulllah
Abdulllah 2020 年 10 月 23 日
編集済み: Walter Roberson 2020 年 10 月 26 日
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?

回答 (1 件)

Walter Roberson
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

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by