MinGW64 Compiler (C++) toolchain is not supported for mkldnn target.

When I use matlab block function on simulink, I get the error
function y= fnc(u)
persistent net
if isempty(net)
net = coder.loadDeepLearningNetwork('32.mat');
end
input= [u];
input=rescale(input);
XTrain = {input'};
output= predict(net, XTrain, 'MiniBatchSize', 1);
y=output{1};
end
Error:Deep learning code generation using MinGW64 Compiler (C++) toolchain is not supported for mkldnn target.
Function 'MATLAB Function' (#426.60.106), line 4, column 11:
"coder.loadDeepLearningNetwork('32.mat')"
Launch diagnostic report.

8 Comments

The documentation does imply that you should be able to use MinGW for mkldnn : the mkl-dnn documentation talks about how the command uses MATLAB Coder, and MATLAB Coder is supported for MinGW in your release.
However, for whatever reason, you are going to need to switch to Microsoft Visual C++ 2022, 2019, or 2017.
I have the latest version Microsoft Visual C++ 2015-2022 Redistributable (x64) -14.42.34438.
But matlab is not work. I meet all time problem with matlab.
The redistributable is not enough: you need the compiler installed.
You are true.
I install mingw-w64 toolchain compilers the from https://code.visualstudio.com/docs/cpp/config-mingw
Then I get same error :((
I install Visual Studio compiler tools 2022 and Visual Studio community 2022.
Desktop development with C++
I get same error.
After you install them, you need to use mex -setup cpp and select Visual C++
Thank you very much, it is working now.
But ı get different 4 fault, could you give some information.
1) Error:Simulink does not have enough information to determine output sizes for this block. If you think the errors below are inaccurate, try specifying types for the block inputs and/or sizes for the block outputs.
2) Error:Input data argument to predict must be dlarray type.
Function 'MATLAB Function' (#200.207.227), line 10, column 9:
"predict(net, XTrain)"
Launch diagnostic report.
3) Error:Simulink cannot determine sizes and/or types of the outputs for block 'Simulink_Doktorailkdosya/MATLAB Function' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
4) Error:Error in port widths or dimensions. 'Output Port 1' of 'Simulink_Doktorailkdosya/MATLAB Function/u' is a [200x6] matrix.

Sign in to comment.

Answers (0)

Products

Release

R2024a

Asked:

on 29 Sep 2025

Commented:

on 8 Oct 2025

Community Treasure Hunt

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

Start Hunting!