How do I compile with shared libraries for my MEX files on Linux?
Show older comments
I'm trying to compile a CPP script, "foo.cpp", that relies on a shared library, "libfoolibrary.so", into a MEX file on Linux. However, even though it compiles successfully, it fails at runtime, giving me the following error message:
>> mex -DLIN -DUNIX -DNDEBUG -D_USRDLL -O foo.cpp -output foo_mex -lfoolibrary -L./
Building LIN64 MEX function...
Building with 'g++'.
MEX completed successfully.
MEX function compilation completed successfully
>> foo_mex
Running the MEX function... Invalid MEX-file '/home/MATLAB/foo_mex.mexa64': libfoolibrary.so: cannot open shared object file: No such file or directory
This doesn't happen when I try to do this on Windows. Am I doing something wrong?
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB Compiler 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!