Borrar filtros
Borrar filtros

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 visualizaciones (últimos 30 días)
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 comentario
Raghav Bansal
Raghav Bansal el 26 de Dic. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre C Shared Library Integration en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by