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

2 Ansichten (letzte 30 Tage)
Shuwei Wang
Shuwei Wang am 26 Feb. 2023
Kommentiert: Rishav am 7 Mär. 2023
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 Kommentar
Rishav
Rishav am 7 Mär. 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?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by