Error using mex: undefined reference for user build package

I run into the the following issue when I try to compile a user-build mex function :
>> mex kalcvf.c
Building with 'gcc'.
Error using mex
/tmp/mex_40203179616654_15298/kalcvf.o: In function `kalcvf':
kalcvf.c:(.text+0x120): undefined reference to `dcopy_'
(...)
the folder includes several files, such as
dlyap.c
kalcvf.c
kalcvf.def
kalcvf.vcproj
kalcvf.vcxproj
kalcvf.filters
kalcvf.user
matlib.c
matlib.h
and in a parent directory
mex.ncb
mex.sdf
mex.sln
What additional steps do I need to take in order to compile the mex function?

4 件のコメント

Jan
Jan 2019 年 7 月 16 日
dcopy_ belongs the BLAS libraries. Did you include them?
mex kalcvf.c libmwlapack.lib libmwblas.lib
Economist_101
Economist_101 2019 年 7 月 16 日
編集済み: Economist_101 2019 年 7 月 16 日
Jan, many thanks for this.
I indeed did not use those libraries (and did not know I should). Running the code returns the following error
Error using mex
gcc: error: libmwlapack.lib: No such file or directory
gcc: error: libmwblas.lib: No such file or directory
I did not find those files anywhere in my matlab folder, nor online. Where should I look? (I am running Matlab 2019a 64bit on a Linux Ubuntu 18.04).
Any pointer is much appreciated!
Jan
Jan 2019 年 7 月 17 日
編集済み: Jan 2019 年 7 月 17 日
mex -v -R2017b yourFcn.c -lmwblas
[MOVED to the section for answers]
Economist_101
Economist_101 2019 年 7 月 17 日
Perfect, this did the trick:
mex -v -R2018a kalcvf/kalcvf.c kalcvf/dlyap.c kalcvf/matlib.c -lmwblas -lmwlapack

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

その他の回答 (1 件)

James Tursa
James Tursa 2019 年 7 月 16 日

0 投票

Try looking in the MATLAB/R2019a/extern/lib folder for versions of these files appropriate for your system. They might have slightly different names than above, but should have lapack and blas as part of the names.

カテゴリ

ヘルプ センター および File ExchangeMATLAB Compiler についてさらに検索

質問済み:

2019 年 7 月 15 日

編集済み:

Jan
2019 年 7 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by