Why do I get the error "'C:\Program' is not recognized as an internal or external command" when using MinGW compiler?

12 views (last 30 days)
I am trying to use a workflow in MATLAB or Simulink that involves a C/C++ compiler. I've selected MinGW as my compiler as per the "mex -setup" command.
However, I get the following error:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Instead of 'C:\Program', the error message may mention a different incomplete path.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 3 May 2023
Edited: MathWorks Support Team on 3 May 2023
This error may be due to a known issue that MinGW does not work if installed in a path that contains spaces, such as:
C:\Program Files\mingw-64
Instead, use:
C:\mingw-64
The recommendation is stated on this documentation page:  
To see where MinGW is installed on your computer, in your MATLAB command prompt, try:
>> getenv('MW_MINGW64_LOC')
Try installing MinGW using the Add-On manager from within MATLAB if you have not done already. This will ensure it is correctly configured and also does not contain white space in the file path of the installation. For more information, see "MATLAB Support for MinGW-w64 C/C++ Compiler".

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!