I use MATLAB's examples for code generation, but it shows following error. Please help me solve this problem quickly.

9 views (last 30 days)
I installed the appropriate version of the mingw-w64 compiler.
MEX configured to use 'MinGW64 Compiler (C)' for C language compilation.
It shows this error when running.

Accepted Answer

mohammad
mohammad on 11 Jul 2023
I solved this problem completely. I want to explain.
* Windows 10
* System type: 64-bit
* Matlab 2021a
Do the following steps
You can get help from this websites for installation :
# You should pay attention to use the VPN during installation so that the package is completely downloaded and installed.
2. After installation, you need to add the path to the Environment Variables.
Adding path to User Variables
Adding path to System Variables
3. Download MinGW 6.3 :
You can get help from this websites for installation :
4. Now, in order to find out that the system recognizes the compiler correctly, we must type the following line in Command Prompt. And we should have such an output.
gcc --version
or
g++ --version
5. Create the environment variable MW_MINGW64_LOC in System Variables with the second MinGW 6.3 like this
6. Download the attached MATLAB function "configuremingw" from the following website and place it in the MATLAB folder.
run command configuremingw in matlab and choose folder
C:\mingw-w64\x86_646.3.0-posix-seh-rt_v5-rev2\mingw64
7. Restart MATLAB and then call 'mex -setup' in MATLAB in order to check and configure MinGW. The output should show something like:
"MEX configured to use 'MinGW64 Compiler (C)'..."
8. Next, we can use MATLAB Help to test the example

More Answers (1)

Sivsankar
Sivsankar on 5 Jul 2023
Have you tried adding mingW to as an environmental variable?Or try adding path of gcc in MingW. Your path might probably be like this C:\MinGW\libexec\gcc\mingw32\MinGW-Version
I am not sure about the path but you could see that in your file explorer. Try adding that path.
  3 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!