Clear Filters
Clear Filters

How to compile C++ function that uses the Boost library on linux machine

11 views (last 30 days)
Now I have a C++ function that includes class files in the same directory, and those classes have functions that uses several functions from the Boost library.
I tried the command:
mex -l:libboost_system.a myMex.cpp
and it compiles, but when I execute the output function:
myMex()
It produces an error:
Invalid MEX-file '/home/path/myMex.mexa64':
/usr/local/MATLAB/R2022b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by
/home/path/myMex.mexa64)
I searched several places online but cannot figure out what to do.
Could any one please show me the standard way to do such a task and show me how I may solve this issue?
Any help is greatly appreciated.
  1 Comment
Rishav
Rishav on 7 Mar 2023
The error message you're seeing suggests that the version of libstdc++ being used by MATLAB doesn't have the required GLIBCXX version. This often happens when you build your MEX file on a newer version of Linux than the one used by MATLAB.
One solution is to build your MEX file on an older version of Linux that is compatible with the version of MATLAB you're using. Is this possible for you?

Sign in to comment.

Answers (0)

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!