Error while running "minimal_example_ocp" in Matlab, Window

Hi :wave:

If you have an issue with acados and are looking for help here, please mention:

  • What interface of acados are you using (C/ Matlab/ Python/ Octave)?
    Matlab R2022a, Window 10

Below is what I got while running the “minimal_example_ocp”

compiling C:\Users\zpqls\Desktop\acados\examples\acados_matlab_octave\..\..\interfaces\acados_matlab_octave\ocp_get_cost.c
Building with 'MinGW64 Compiler (C)'.
MEX completed successfully.
compiling C:\Users\zpqls\Desktop\acados\examples\acados_matlab_octave\..\..\interfaces\acados_matlab_octave\ocp_get.c
Building with 'MinGW64 Compiler (C)'.
MEX completed successfully.
compiling C:\Users\zpqls\Desktop\acados\examples\acados_matlab_octave\..\..\interfaces\acados_matlab_octave\ocp_eval_param_sens.c
Building with 'MinGW64 Compiler (C)'.
MEX completed successfully.
acados MEX interface compiled successfully
Successfully rendered acados templates!
Error using acados_template_mex.compile_ocp_shared_lib
Building templated code as shared library failed.
Got status 2, result: [ 20%] Building C object
CMakeFiles/model_pendulum.dir/pendulum_model/pendulum_expl_ode_fun.c.obj
[ 40%] Building C object CMakeFiles/model_pendulum.dir/pendulum_model/pendulum_expl_vde_forw.c.obj
[ 60%] Building C object CMakeFiles/model_pendulum.dir/pendulum_model/pendulum_expl_vde_adj.c.obj
[ 60%] Built target model_pendulum
[ 80%] Building C object CMakeFiles/ocp_pendulum.dir/acados_solver_pendulum.c.obj
[ 80%] Built target ocp_pendulum
[100%] Linking C shared library acados_ocp_solver_pendulum.dll
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xe1):
undefined reference to `ocp_nlp_in_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x10b):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x551):
undefined reference to `ocp_nlp_dims_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x56f):
undefined reference to `ocp_nlp_dims_set_opt_vars'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x587):
undefined reference to `ocp_nlp_dims_set_opt_vars'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x5a3):
undefined reference to `ocp_nlp_dims_set_opt_vars'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x5bf):
undefined reference to `ocp_nlp_dims_set_opt_vars'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x61d):
undefined reference to `ocp_nlp_dims_set_constraints'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x63d):
undefined reference to `ocp_nlp_dims_set_constraints'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x65d):
undefined reference to `ocp_nlp_dims_set_constraints'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x67d):
undefined reference to `ocp_nlp_dims_set_constraints'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x69d):
undefined reference to `ocp_nlp_dims_set_constraints'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x6bd):
more undefined references to `ocp_nlp_dims_set_constraints' follow
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x72d):
undefined reference to `ocp_nlp_dims_set_cost'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x76e):
undefined reference to `ocp_nlp_dims_set_cost'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x798):
undefined reference to `ocp_nlp_dims_set_constraints'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x7bc):
undefined reference to `ocp_nlp_dims_set_constraints'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x7fc):
undefined reference to `ocp_nlp_dims_set_constraints'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x81e):
undefined reference to `ocp_nlp_dims_set_constraints'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x84f):
undefined reference to `ocp_nlp_dims_set_constraints'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x86f):
more undefined references to `ocp_nlp_dims_set_constraints' follow
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x88f):
undefined reference to `ocp_nlp_dims_set_cost'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x8cc):
undefined reference to `ocp_nlp_dims_set_cost'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x8f0):
undefined reference to `ocp_nlp_dims_set_constraints'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x914):
undefined reference to `ocp_nlp_dims_set_constraints'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x991):
undefined reference to `external_function_param_casadi_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x9f1):
undefined reference to `external_function_param_casadi_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xa90):
undefined reference to `ocp_nlp_in_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xaba):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xafc):
undefined reference to `ocp_nlp_dynamics_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xb2a):
undefined reference to `ocp_nlp_dynamics_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xb6e):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xbd0):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xc26):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xc6f):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xcd3):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xd57):
more undefined references to `ocp_nlp_cost_model_set' follow
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xf9c):
undefined reference to `ocp_nlp_constraints_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xfc4):
undefined reference to `ocp_nlp_constraints_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0xfef):
undefined reference to `ocp_nlp_constraints_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1050):
undefined reference to `ocp_nlp_constraints_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x10e0):
undefined reference to `ocp_nlp_constraints_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1104):
more undefined references to `ocp_nlp_constraints_model_set' follow
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x11d0):
undefined reference to `ocp_nlp_in_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x11f7):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x127b):
undefined reference to `ocp_nlp_solver_opts_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x12a2):
undefined reference to `ocp_nlp_solver_opts_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x12db):
undefined reference to `ocp_nlp_solver_opts_set_at_stage'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x130f):
undefined reference to `ocp_nlp_solver_opts_set_at_stage'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1340):
undefined reference to `ocp_nlp_solver_opts_set_at_stage'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1371):
undefined reference to `ocp_nlp_solver_opts_set_at_stage'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x139f):
undefined reference to `ocp_nlp_solver_opts_set_at_stage'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x13c5):
undefined reference to `ocp_nlp_solver_opts_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x13e7):
undefined reference to `ocp_nlp_solver_opts_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x141a):
undefined reference to `ocp_nlp_solver_opts_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x143e):
undefined reference to `ocp_nlp_solver_opts_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x145a):
undefined reference to `ocp_nlp_solver_opts_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x148f):
more undefined references to `ocp_nlp_solver_opts_set' follow
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x169a):
undefined reference to `ocp_nlp_plan_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1777):
undefined reference to `ocp_nlp_config_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1801):
undefined reference to `external_function_param_casadi_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1861):
undefined reference to `external_function_param_casadi_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x187d):
undefined reference to `ocp_nlp_in_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x18c0):
undefined reference to `ocp_nlp_in_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x18e7):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x191e):
undefined reference to `ocp_nlp_dynamics_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x194c):
undefined reference to `ocp_nlp_dynamics_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x198b):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x19ed):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1a43):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1a8c):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1ad8):
undefined reference to `ocp_nlp_cost_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1b53):
more undefined references to `ocp_nlp_cost_model_set' follow
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1d7f):
undefined reference to `ocp_nlp_constraints_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1da7):
undefined reference to `ocp_nlp_constraints_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1dd2):
undefined reference to `ocp_nlp_constraints_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1e33):
undefined reference to `ocp_nlp_constraints_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1eb0):
undefined reference to `ocp_nlp_constraints_model_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1ed4):
more undefined references to `ocp_nlp_constraints_model_set' follow
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1f34):
undefined reference to `ocp_nlp_solver_opts_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1f5d):
undefined reference to `ocp_nlp_out_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1f76):
undefined reference to `ocp_nlp_out_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x1fe4):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x200b):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2039):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2066):
undefined reference to `ocp_nlp_solver_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2082):
undefined reference to `ocp_nlp_precompute'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2120):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2147):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2175):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x21ab):
undefined reference to `ocp_nlp_precompute'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x221b):
undefined reference to `ocp_nlp_plan_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2312):
undefined reference to `ocp_nlp_config_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2391):
undefined reference to `external_function_param_casadi_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x23f1):
undefined reference to `external_function_param_casadi_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2409):
undefined reference to `ocp_nlp_in_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2431):
undefined reference to `ocp_nlp_solver_opts_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x244e):
undefined reference to `ocp_nlp_out_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2463):
undefined reference to `ocp_nlp_out_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x24e0):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2507):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x253d):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x255e):
undefined reference to `ocp_nlp_solver_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2576):
undefined reference to `ocp_nlp_precompute'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x25df):
undefined reference to `ocp_nlp_solver_destroy'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2623):
undefined reference to `ocp_nlp_solver_opts_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x263c):
undefined reference to `ocp_nlp_solver_create'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2654):
undefined reference to `ocp_nlp_precompute'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x26f0):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2714):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2738):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x275c):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2780):
undefined reference to `ocp_nlp_out_set'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x27a4):
more undefined references to `ocp_nlp_out_set' follow
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2825):
undefined reference to `ocp_nlp_get'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2864):
undefined reference to `ocp_nlp_solver_reset_qp_memory'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x294b):
undefined reference to `ocp_nlp_solve'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2978):
undefined reference to `ocp_nlp_solver_opts_destroy'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2982):
undefined reference to `ocp_nlp_in_destroy'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x298d):
undefined reference to `ocp_nlp_out_destroy'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2998):
undefined reference to `ocp_nlp_out_destroy'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x29a3):
undefined reference to `ocp_nlp_solver_destroy'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x29ae):
undefined reference to `ocp_nlp_dims_destroy'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x29b9):
undefined reference to `ocp_nlp_config_destroy'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x29c4):
undefined reference to `ocp_nlp_plan_destroy'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x29dc):
undefined reference to `external_function_param_casadi_free'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x29ec):
undefined reference to `external_function_param_casadi_free'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2a59):
undefined reference to `ocp_nlp_get'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2a7b):
undefined reference to `ocp_nlp_get'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2a9d):
undefined reference to `ocp_nlp_get'
CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x2abb):
undefined reference to `ocp_nlp_get'
collect2.exe: error: ld returned 1 exit status
CMakeFiles\acados_ocp_solver_pendulum.dir\build.make:89: recipe for target
'acados_ocp_solver_pendulum.dll' failed
mingw32-make.exe[2]: *** [acados_ocp_solver_pendulum.dll] Error 1
CMakeFiles\Makefile2:138: recipe for target 'CMakeFiles/acados_ocp_solver_pendulum.dir/all' failed
mingw32-make.exe[1]: *** [CMakeFiles/acados_ocp_solver_pendulum.dir/all] Error 2
Makefile:134: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2


Error in ocp_generate_c_code (line 279)
    acados_template_mex.compile_ocp_shared_lib(obj.acados_ocp_nlp_json.code_export_directory)

Error in acados_ocp (line 203)
            ocp_generate_c_code(obj);

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

Thank you for reading this question.
Please let me know if I post in wrong way.

Hi :wave:

I’m experiencing the same problem with MATLAB R2022b on Windows 10. Has anyone found a solution?

Hi,

these undefined references typically mean that the headers are not found correctly.
Could you check if:

  • the include directory which should be in <acados_source_dir>/include is set up correctly?
  • the include directory is set correctly in the generated CMakeLists file. This file should be in the subfolder c_generated_code of the example folder. You can search for set(ACADOS_INCLUDE_PATH there.

Best
Jonathan

Hi Jonathan,

Thanks for your very prompt reply.

It’s difficult for me to check if the <acados_source_dir>/include file is setup correctly. I guess it’s correct.
Structure of the include/ folder :
include/acados/
include/acados/dense_qp/
include/acados/ocp_nlp/
include/acados/ocp_qp/
include/acados/sim/
include/acados/utils/
include/acados_c/
include/acados_c/ocp_nlp_interface.h (which contains the function ocp_nlp_get trigerring one of the errors, and probably the other function)
include/blasfeo/
include/blasfeo/include/
include/hpipm/
include/hpipm/include/

Also, the CMakeLists file does contain the reference to this folder.
set(ACADOS_INCLUDE_PATH C:/ProgramFiles/acados/examples/acados_matlab_octave/../../include CACHE PATH "Define the path which contains the include directory for acados.")

However, I have made another observation that could help in understanding my issue. If I don’t run the script acados_env_variables_windows.m before running the getting_started example, then I get a different error.

>> run('C:\ProgramFiles\acados\examples\acados_matlab_octave\getting_started\minimal_example_ocp.m')
using acados simulink default options
'get_acados_simulink_opts' is not found in the current folder or on the MATLAB path, but exists in:
    C:\ProgramFiles\acados\interfaces\acados_matlab_octave

Change the MATLAB current folder or add its folder to the MATLAB path.

Error in minimal_example_ocp (line 36)
    simulink_opts = get_acados_simulink_opts;

Error in run (line 91)
evalin('caller', strcat(script, ';'));

I’m wondering if this could be related to incorrect path initialization. When I run acados_env_variables_windows.m, it seems to set up enough paths to get partial results, but not enough for full execution.

Hi again :wave:,

I have pushed the investigation further (without much results). However, if you could answer to the following questions, it would greatly help me figuring out what’s going on.

  1. When you run minimal_example_ocp.m, it creates a c_generated_code folder. If you go to c_generated_code/CMakeFiles/acados_ocp_solver_pendulum.dir and open objects.a. Do you get a readable file when you open it with the Notepad? In my case, it’s unreadable.
    That could explain the error messages: >CMakeFiles\acados_ocp_solver_pendulum.dir/objects.a(acados_solver_pendulum.c.obj):acados_solver_pendulum.c:(.text+0x241b):
    undefined reference to `ocp_nlp_get’<
    , in particular the part (.text+0x241b).

  2. In the CMakeLists, there is indeed a setup of the <acados_source_dir>/include, but it is possible that it is incomplete. The main paths are setup correctly

# set some search paths for preprocessor and linker
set(ACADOS_INCLUDE_PATH C:/ProgramFiles/acados/examples/acados_matlab_octave/../../include CACHE PATH "Define the path which contains the include directory for acados.")
set(ACADOS_LIB_PATH C:/ProgramFiles/acados/examples/acados_matlab_octave/../../lib CACHE PATH "Define the path which contains the lib directory for acados.")

But not all the subdirectories are included:

include_directories(
   ${ACADOS_INCLUDE_PATH}
   ${ACADOS_INCLUDE_PATH}/acados
   ${ACADOS_INCLUDE_PATH}/blasfeo/include
   ${ACADOS_INCLUDE_PATH}/hpipm/include
)

Are not included:

  • ${ACADOS_INCLUDE_PATH}/acados_c
  • ${ACADOS_INCLUDE_PATH}/osqp
  • ${ACADOS_INCLUDE_PATH}/qdldl

And maybe acado_c would be requiered.

  1. On a Linux computer, I have done the installation without any issue. Is it possible to generate sfunctions for Simulink (on windows) from this Linux computer which doesn’t have matlab? :crossed_fingers: It’s just a little sad not to do everything on the same platform.

Thank you in avance for your help
Aris

Hi :wave:,

Problem solved! My mistake was to set a wrong path to cmake.exe.

Several advices for those who are facing the same issue as me:

  1. When you download cmake, it will come as a file with a name similar to: cmake-3.30.1-windows-x86_64. Once unzipped, rename it with simple caracters, e.g.: cmake (matlab won’t like all the dots of the original name).

  2. Then, be carefull of which path to cmake.exe you setup in your environement variables paths. There are 2 of those: cmake/bin/cmake.exe and cmake/CMake/bin/cmake.exe. Using the first one is what caused my issues. I guess the first one is for windows x86, and the second for x64

I hope this will help

1 Like

Hi,

I just saw your posts.
Thanks a lot for sharing your solution!
Great that you managed to fix it and have fun with acados now :slight_smile:

1 Like