MEX function cannot be called without its file extension.

1 次查看(过去 30 天)
Hello everyone!
I was trying to run a code in Linux that in Windows runs without any error. It outputs an error “Undefined function or variable 'convConst'.”
The convConst function is a MEX file and solutions suggested to add the folder in the path.
I used “addpath” and added the folder to the path, but the problem remains.
When I use “which convConst” I have the following outputs:
>> which convConst
convConst' not found.
>> which convConst.cpp
/home/chung/Documents/agapi/Other_approaches/02_DehazeNet/DehazeNet-master/convConst.cpp
>> which convConst.mexw64
/home/chung/Documents/agapi/Other_approaches/02_DehazeNet/DehazeNet-master/convConst.mexw64
Any ideas on how to fix the problem?
I use Matlab R017b and Linux Mint 19.

采纳的回答

Agapi Dav
Agapi Dav 2018-9-12
Ok, I found the solution. The file extension of the MEX file indicated that it should be compiled in Linux.
Thus, I used the command mex followed by the path of the .cpp file and it compiled perfectly. Now the function is callable when I type "convConst".
Cheers!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by