Azzera filtri
Azzera filtri

building c++ interface with gcc 10.4 on ubuntu

6 visualizzazioni (ultimi 30 giorni)
Trevor
Trevor il 12 Ott 2023
Modificato: Trevor il 8 Nov 2023
Hello,
I am following the c++ publish Interface workflow: https://www.mathworks.com/help/matlab/ref/clibpublishinterfaceworkflow.html to create a MATLAB interface to a c++ library (some headers and linking to a dynamic lib).
I have this working on Windows and Mac with C++17.
However on Ubuntu gcc 10.4 I get errors such as the following:
error: declaration of function template "std::__cxx11::basic_string" had a
different meaning during compilation of
"/home/builds/builds/q_CyKAXm/0/software/control_api/MC_API/motioncontrolAPI.h"
(template types do not match)
I am prepending the gcc 10.4 bin path to my working PATH variable and then calling in the MATLAB script:
mex -setup:g++
which does seem to recognize the right compiler etc. The library I am linking to was also built with the same compiler.
I've attached the build log with the errors near the bottom, as well as the MATLAB script used to generate the interface.
Any ideas or help appreciated,
-Trevor
  1 Commento
Trevor
Trevor il 8 Nov 2023
Modificato: Trevor il 8 Nov 2023
To Follow up,
The current solution is to use a single combined header to use as the interface - for whatever reason the interface build works when using 1 header, and throws the error when using more than 1 header. (It appears as if Matlab doesnt follow the #include <xxxxx.h> paths during the interface generation )Which is different on windows and macos.
-Trevor

Accedi per commentare.

Risposte (0)

Tag

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by