Azzera filtri
Azzera filtri

'File format not recognized" using mex

17 visualizzazioni (ultimi 30 giorni)
Vytautas Valaitis
Vytautas Valaitis il 21 Lug 2020
Risposto: Nipun Katyal il 14 Ago 2020
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?

Risposte (1)

Nipun Katyal
Nipun Katyal il 14 Ago 2020
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.

Categorie

Scopri di più su Write C Functions Callable from MATLAB (MEX Files) in Help Center e File Exchange

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by