building c++ interface with gcc 10.4 on ubuntu

6 次查看(过去 30 天)
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 个评论
Trevor
Trevor 2023-11-8
编辑:Trevor 2023-11-8
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

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Call C++ from MATLAB 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by