Hello,
I am trying to create an API between MATLAB and C++ so that my team members, who don't have a MATLAB license, can use it with just the MATLAB Runtime. I used the C++ shared library to generate the API. After downloading MINGW8.1 and the Windows SDK, and setting the appropriate paths in my environment, I successfully compiled my example.cpp file.
However, when I tried to install my application on another computer that doesn't have MATLAB, I encountered an issue. Despite installing MINGW8.1, the Windows SDK, and my API application, the compiler was not found. Using the mex -setup command in the command prompt in the computer with MATLAB, I noticed that my computer uses compilers located in the .../MATLAB/... directory. It seems that I still need MATLAB to compile a standalone API.
Can I change the compiler path, and if so, how can I do it?
C:\Users\UserName>mex -setup c++
MEX configured to use 'MinGW64 Compiler with Windows 10 SDK or later (C++)' for C++ language compilation.
To choose a different C++ compiler, execute one from the following:
For MinGW64 Compiler (C++): mex -setup:"C:\Program Files\MATLAB\R2024a\bin\win64\mexopts\mingw64_g++.xml" C++
For MinGW64 Compiler with Windows 10 SDK or later (C++): mex -setup:C:\Users\User\AppData\Roaming\MathWorks\MATLAB\R2024a\mex_C++_win64.xml C++
For Microsoft Visual C++ 2022: mex -setup:"C:\Program Files\MATLAB\R2024a\bin\win64\mexopts\msvcpp2022.xml" C++
Additionally, I am trying to connect my API with another C++ program, such as OpenFOAM, which requires a different C++ compiler. Do I need to compile both .cpp files separately with different compilers, or is there a better solution to this problem?