Error: Generated code from your project uses OpenCV and requires that you use a supported C++ compiler. Use 'mex -setup' to select a supported C++ compiler.

I am currently encountering an issue while generating code from my Simulink project. The error message I am receiving is as follows:
"Generated code from your project uses OpenCV and requires that you use a supported C++ compiler. Use 'mex -setup' to select a supported C++ compiler."
I have followed the suggested steps by running the command mex -setup C++ and have ensured that a supported C++ compiler is selected. Additionally, I have installed OpenCV as per the requirements. Despite these efforts, I am still facing the same error when attempting to generate code

Answers (2)

Hello,
I understand you're facing an issue with generating code from your Simulink project, and the error message indicates the need for a supported C++ compiler.
I’ve included two links below that list the supported compilers for various MATLAB versions. Please refer to them to ensure that your current C++ compiler is compatible with your specific version of MATLAB:
I hope this helps to resolve the issue.
Regards,
Shivam.

3 Comments

Hello, Thanks for answering.
At first I am getting this error:
"Error:No supported compiler detected. A compiler is required by some simulation modes and code generation workflows.
You can download the MinGW compiler by using Add-On Explorer. Click MATLAB Support for MinGW-w64 C/C++ Compiler.
For a complete list of supported compilers, see https://www.mathworks.com/support/compilers.
After installing a supported compiler, restart MATLAB."
But after installing MATLAB Support for MinGW-w64 C/C++ Compiler I am facing this error.
And I am using MatlabR2024b where it is written "MinGW 8.1 is supported for automatic installation"
or I have to install MinGW 8.1 manually.
The OpenCV interface requires that you use Visual Studios.
Yes I have install visual studio 2022 Community.
But still getting the same error.

Sign in to comment.

Products

Release

R2024b

Asked:

on 9 Nov 2024

Commented:

on 13 Nov 2024

Community Treasure Hunt

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

Start Hunting!