Windows+Matlab: Error while trying basic example

Hi :wave:

I tried to get into Acados. Installed everything according to the docs and always get this error message while trying to compile the minimal_example_ocp.m:

compiling C:\Users\phman\Documents\repos\acados\examples\acados_matlab_octave\..\..\interfaces\acados_matlab_octave\ocp_create.c
Building with 'MinGW64 Compiler (C)'.
Error using mex
undefined reference to `__imp___acrt_iob_func'
undefined reference to `__imp___acrt_iob_func'
undefined reference to `__imp___acrt_iob_func'
undefined reference to `__imp___acrt_iob_func'
undefined reference to `__imp___acrt_iob_func'
more undefined references to `__imp___acrt_iob_func' follow
collect2.exe: error: ld returned 1 exit status

Error in ocp_compile_interface (line 176)
        mex(mex_flags, FLAGS, LDFLAGS, COMPDEFINES, COMPFLAGS, acados_include, acados_interfaces_include, external_include,
        blasfeo_include, hpipm_include,...

Error in acados_ocp (line 181)

Error in minimal_example_ocp (line 108)
ocp = acados_ocp(ocp_model, ocp_opts);

The error is similar to what was discussed in this thread. However, I have tried disabling the external solvers like OSQP and QPoases without any improvement. I am at my wits end :slight_smile:
Further, I have seen that the cmake file includes a ACADOS_MATLAB option which is set to OFF by default. What does that do? I recompiled with the flag ON, but didn’t change anything.


  • Windows 11 10.0.22621 Build 22621
  • Matlab R2021a

I have as well noticed, that the acados_env_variables_windows.m is missing in the up-to-date branch on github [here].


Problem solved:

  • Didn’t read the docs carefully enough: Add the subfolders `bin` and `x86_64-w64-mingw32\bin`. only added the second one.
  • Additionally I had a msys2 installation on my system which could have interfered with the mingw from matlab. So I removed it. To find it use: where.exe mingw32-make.exe

Thanks for posting this, I had exactly the same issue. Now it’s running fine :slight_smile: