Errors when generating a MATLAB interface to a C++ library

5 Ansichten (letzte 30 Tage)
Aleksandar
Aleksandar am 7 Jan. 2024
Beantwortet: Aleksandar am 11 Jan. 2024
Hello,
I'm having difficulties with generating a MATLAB interface to a C++ library GitHub - ORNL/TASMANIAN: The Toolkit for Adaptive Stochastic Modeling and Non-Intrusive ApproximatioN. I'm using Ubuntu 22.04.3 LTS and MATLAB version 2023a. First, I build the Tasmanian library with CMake and GCC 11 and install it to a custom directory, which generates the header files in <install_dir>/include directory and library .so files in <install_dir>/lib directory. I then run the clibPublishInterfaceWorkflow function and in the Generate C++ Interface section select all the header files and .so files. When I click on Generate definition file, it prints "MEX configured to use 'g++' for C++ language compilation.", runs for some time, but exits with several errors like:
/usr/include/c++/11/bits/basic_string.h(6064):
error: declaration of function template "std::__cxx11::basic_string" had a different meaning during compilation of "<install_dir>/include/Tasmanian.h" (template types do not match)
or
/usr/include/c++/11/array(267):
error: declaration of function template "std::array" had a different meaning during compilation of "<install_dir>/include/Tasmanian.h" (template types do not match)
What could be the issue here?

Akzeptierte Antwort

Aleksandar
Aleksandar am 11 Jan. 2024
I can confirm that issues with multiple header files are not there on Windows either with mingw81 or Visual C++ 2022. However, I still haven't succeeded in generating the interface as Matlab taskes up more than 12GB of RAM and crashes (my system has 16GB, but apparently it's not enough). I'll open another thread for this issue.

Weitere Antworten (0)

Kategorien

Mehr zu Call C++ from MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by