MEX function cannot be called without its file extension.

4 ビュー (過去 30 日間)
Agapi Dav
Agapi Dav 2018 年 9 月 12 日
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!
  1 件のコメント
Thanaphong Phongpreecha
Thanaphong Phongpreecha 2019 年 7 月 17 日
Thank you for posting your solution, saved me a ton of time.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by