Borrar filtros
Borrar filtros

'File format not recognized" using mex

17 visualizaciones (últimos 30 días)
Vytautas Valaitis
Vytautas Valaitis el 21 de Jul. de 2020
Respondida: Nipun Katyal el 14 de Ag. de 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?

Respuestas (1)

Nipun Katyal
Nipun Katyal el 14 de Ag. de 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.

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by