Borrar filtros
Borrar filtros

building c++ interface with gcc 10.4 on ubuntu

9 visualizaciones (últimos 30 días)
Trevor
Trevor el 12 de Oct. de 2023
Editada: Trevor el 8 de Nov. de 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 comentario
Trevor
Trevor el 8 de Nov. de 2023
Editada: Trevor el 8 de Nov. de 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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Call C++ from MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by