C compilation from Unix to Windows with MEX (2014b)

2 views (last 30 days)
I am trying to compile a Unix-created C file on a Windows machine. The source code and all its dependencies compile and work fine on the Unix computer outside of Matlab, but as soon as I import the files to Windows and try to compile with MEX, I get a link error saying it cannot find a .lib file:
LINK : error LNK2001: unresolved external symbol mexFunction
irt_to_utc.lib : fatal error LNK1120: 1 unresolved externals
I do have a .so file, though when I tried including it in the MEX command, I got another link error:
Error using mex
lib_sng_time.so : fatal error LNK1107: invalid or corrupt file: cannot read at 0xFE10
All of the appropriate dependencies are in the files and headers, so can I force MEX to compile without a .lib file? Can MEX be configured to accept .so files instead of .lib files? Maybe I am misinterpreting how MEX works.
Thanks for the help
I'm pretty new to Matlab and even newer to C compilation, so I apologize if this is not clear.
  1 Comment
Geoff Hayes
Geoff Hayes on 27 Jan 2015
Brett - what is the line of code (or commands) that you are using to build the MEX function. Note that the so file (shared object) is not appropriate for use in Windows (at least that is my understanding). You would need a dll or lib (?) equivalent of your so file. What functions are in your irt_to_utc.so that are required by your MEX function?

Sign in to comment.

Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!