Windows: Errors in examples of generic_external_cost

Hi :wave:

I am newly to use ACADOS. I have installed ACADOS in windows using Matlab interface. The example of getting_started runs ok. However, when I turned to the example of generic_external_cost, some errors occurred. The errors are:

found compiled acados MEX interface
C:\Users\zhuangx\AppData\Local\Temp\cc6CY5Px.o:generic_ext_cost.c:(.text+0x55): undefined reference to `blasfeo_dgese' 
C:\Users\zhuangx\AppData\Local\Temp\cc6CY5Px.o:generic_ext_cost.c:(.text+0x1b6): undefined reference to `blasfeo_dgese' 
collect2.exe: error: ld returned 1 exit status 
Error using ocp_generate_casadi_ext_fun (line 243)
Compilation of model functions failed! Please check the compile command above and the flags therein closely. Compile command was:
gcc -O2 -fPIC -shared -IC:\Research\acados\examples\acados_matlab_octave\..\.. -IC:\Research\acados\examples\acados_matlab_octave\..\..\external\blasfeo\include
C:\Research\acados\examples\acados_matlab_octave\generic_external_cost\build\pendulum_dyn_expl_vde_forw.c generic_ext_cost.c -o

Error in acados_ocp (line 197)
                ocp_generate_casadi_ext_fun(obj.model_struct, obj.opts_struct);

Error in external_cost_example_ocp (line 135)
ocp = acados_ocp(ocp_model, ocp_opts);
this error message

Looking for your help :pray:



I got the same error message when running this in matlab 2021b on windows 64 bit. Does anyone have a clue? @FreyJo ? Is the generic_ext_cost.c broken? Do you have to provide additional data / libs? Do we have to compile the pendulum library externally?

best regards and thanks,


in Windows with MSVC it seems to be an issue about the dll-linking. The blasfeo is linked static and for a dynamic linking it needs some modification in the header => something like:

If I fix it for blasfeo_dgese the next blasfeo function makes trouble.
But not sure if this goes in the proper direction…


I can’t reproduce this on Linux.
Marked it as a Windows specific and will check on Windows soon…

I have a working Matlab on Windows again and was able to reproduce this.
I am not sure how to fix it though.

@mss right is is definitely a dll linking issue.
I tried adding __declspec(dllexport) in front of the blasfeo_dgese declaration in the header, but it seems this doesn’t fix the issue.

@FreyJo Hi Frey, any updates on this issue? I got the same error when running the “generic_dyn_disc” example on Windows.


@Yutao Nope, I didn’t look into it again.