MEX function cannot be called without its file extension.

4 views (last 30 days)
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.

Accepted Answer

Agapi Dav
Agapi Dav on 12 Sep 2018
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!

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!