필터 지우기
필터 지우기

System error:Shar​edMemory:g​etCurrentU​ser:getlog​in_r:error​=25 on wsl when connecting to Matlab from C++ with matlab::en​gine::conn​ectMATLAB(​)

조회 수: 1 (최근 30일)
I'm using C++ to run a MATLAB script. The code is simple:
std::cout << "Starting matlab" << std::endl;
matlab = matlab::engine::startMATLAB();
std::cout << "matlab started, connecting to matlab" << std::endl;
matlab::engine::connectMATLAB();
std::cout << "Connected to MATLAB" << std::endl;
MATLAB can be started, but not connected to. I never reach the last line of the code. Instead, I receive the following error:
terminate called after throwing an instance of 'std::runtime_error'
what(): System error:SharedMemory:getCurrentUser:getlogin_r:error=25
I have MATLAB installed and include
#include "MatlabDataArray.hpp"
#include "MatlabEngine.hpp"
This is most likely somehow related to the fact that I'm running this on WSL (kernel 5.10.16.3-microsoft-standard-WSL2). The same code works on a real Ubuntu 20.04 (not wsl).
Not sure if related, but always the first time I start MATLAB from WSL after a reboot of WSL, I need to reactivate it.
The host machine I'm using runs on Windows 11.
  댓글 수: 1
Raghav Bansal
Raghav Bansal 2023년 12월 26일
I think similar issue was resolved in the latest release of the MATLAB i.e. R2023b. You may try to install the latest release and check if the issue still persists.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 C Shared Library Integration에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by