'File format not recognized" using mex

2 ビュー (過去 30 日間)
Vytautas Valaitis
Vytautas Valaitis 2020 年 7 月 21 日
回答済み: Nipun Katyal 2020 年 8 月 14 日
Hi,
I'm trying to create a mex executable to a file that uses a linker to a library "libraryname", where libraryname.lib is a linker that I created on my machine using "lib" function from VC++. Everything works well when I run mex on the same machine that was used to create the .lib file. Now I want to run this on the cluster, but there I cannot create a new .lib file, so I need to use the .lib file that I created on my computer. When I run the same mex command on the cluster machine I get the following error:
Command:
mex source_code.c libraryname.lib
error:
/usr/bin/ld: libraryname.lib(libraryname.dll): Recognised but unhandled machine
type (0x8664) in Import Library Format archive
libraryname.lib: error adding symbols: File format not recognized
collect2: error: ld returned 1 exit status
I found a much older thread on a similar problem here, but I'm not sure if this is applicable to Matlab 2019b
Could anyone give a hint on how to resolve this?

回答 (1 件)

Nipun Katyal
Nipun Katyal 2020 年 8 月 14 日
This problem occurs because the supported file type is .so/.dll and not .lib/.dll. If you want to tell the linker to link this library you should specify it in this format
mex source file<*.c> -L<path to the library> -lLibraryName
here is the link for usage.

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by