필터 지우기
필터 지우기

building c++ interface with gcc 10.4 on ubuntu

조회 수: 10 (최근 30일)
Trevor
Trevor 2023년 10월 12일
편집: Trevor 2023년 11월 8일
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