Filter löschen
Filter löschen

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(​)

2 Ansichten (letzte 30 Tage)
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 Kommentar
Raghav Bansal
Raghav Bansal am 26 Dez. 2023
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu C Shared Library Integration finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by