Clear Filters
Clear Filters

building c++ interface with gcc 10.4 on ubuntu

3 views (last 30 days)
Trevor
Trevor on 12 Oct 2023
Edited: Trevor on 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 Comment
Trevor
Trevor on 8 Nov 2023
Edited: Trevor on 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

Sign in to comment.

Answers (0)

Tags

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!