Unable to set up C++ compiler

19 views (last 30 days)
Annamalai
Annamalai on 1 Oct 2024
Edited: nick on 3 Oct 2024
Hello,
I've been trying for so long to set up the required addons to run my code in MATLAB GPU. I had to install and configure various addons for the same, one such is C++ compiler. I installed MinGW64 and placed it in varous locations in my computer and run the coder.checkGpuInstall(full). Matlab isn't recognising MinGW 64 at all. I've also tried changing the directory address.
Someone please help me with it...
  3 Comments
Walter Roberson
Walter Roberson on 2 Oct 2024
You do not indicate which MATLAB release this is for.
MATLAB R2023a generally supports VS2022, but does not support VS2022 for GPU compilation.
Your symptoms are in line with the possibility that you are running R2023a.

Sign in to comment.

Answers (1)

nick
nick on 1 Oct 2024
Hi Annamalai,
I understand from your query that MinGW64 is not recognized in MATLAB command window. Please make sure that the version of MinGW-w64 installed on the system is compatible with version of MATLAB. You can check MATLAB's supported compilers in the following documentation :
After ensuring that the bin directory of the MinGW-w64 installation is added to the system PATH environment variable, kindly open a new MATLAB session. You can use the following command to display information about the available compiler for C++ for building MEX files:
mex -setup C++ -v
If MinGW64 is shown as an available compiler in the list, you can use the 'lang' option to change the default compiler for C++.
Aternatively, MATLAB provides an add-on for MinGW-w64, 'MATLAB Support for MinGW-w64 C/C++/Fortran Compiler', which can be installed through the Add-On Explorer. To open the Add-On Explorer, navigate to the Home tab. In the Environment section, click the Add-Ons icon. You can refer the following documentation to know more about the add-on :
  2 Comments
Annamalai
Annamalai on 2 Oct 2024
Edited: Annamalai on 2 Oct 2024
Here is the result of this code mex -setup C++ -v: It has found the MinGW 64 in my computer but when i run the Check, it fails again.
nick
nick on 3 Oct 2024
Edited: nick on 3 Oct 2024
The function 'coder.checkGpuInstall' is part of the product 'GPU Coder'. Kindly use the following documentation to identify the compatible C++ compiler with GPU Coder for the MATLAB release installed on your system:
For example, according to this documentation for GPU Coder in MATLAB R2024b, Microsoft Visual C++ 2022, not MinGW, is the supported C++ compiler.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!