Undefined references when building the generated s-fucntion

Hello :wave:

I am using the Matlab interface of acados to run MPC on a speedgoat target. The compilers in Matlab are set to VS 2017. The generated s-function runs perfectly in a simulation. However, when I try to build the simulink file with slrealtime, there are loads of undefiend references:

C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: acados_solver_sfunction_mls_mpc.o: in function `mdlTerminate': 
C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:312: undefined reference to `mls_mpc_acados_free' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: acados_solver_sfunction_mls_mpc.o: in function `mdlOutputs': 
C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:160: undefined reference to `mls_mpc_acados_get_nlp_config' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:161: undefined reference to `mls_mpc_acados_get_nlp_dims' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:162: undefined reference to `mls_mpc_acados_get_nlp_in' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:163: undefined reference to `mls_mpc_acados_get_nlp_out' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:179: undefined reference to `ocp_nlp_constraints_model_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:184: undefined reference to `ocp_nlp_constraints_model_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:193: undefined reference to `ocp_nlp_cost_model_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:203: undefined reference to `ocp_nlp_cost_model_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:213: undefined reference to `ocp_nlp_cost_model_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:220: undefined reference to `ocp_nlp_constraints_model_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:228: undefined reference to `ocp_nlp_constraints_model_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:236: undefined reference to `ocp_nlp_constraints_model_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:244: undefined reference to `ocp_nlp_constraints_model_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:251: undefined reference to `ocp_nlp_cost_model_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:258: undefined reference to `ocp_nlp_cost_model_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:264: undefined reference to `ocp_nlp_cost_model_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:271: undefined reference to `ocp_nlp_out_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:276: undefined reference to `ocp_nlp_solver_opts_set' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:277: undefined reference to `mls_mpc_acados_solve' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:279: undefined reference to `ocp_nlp_get' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:287: undefined reference to `ocp_nlp_out_get' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:293: undefined reference to `ocp_nlp_out_get' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:303: undefined reference to `ocp_nlp_get' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: acados_solver_sfunction_mls_mpc.o: in function `mdlStart': 
C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:150: undefined reference to `mls_mpc_acados_create_capsule' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:151: undefined reference to `mls_mpc_acados_create' 
C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\slrealtime\target\supportpackage\qnx710\\host\win64\x86_64\usr\bin\x86_64-pc-nto-qnx7.1.0-ld: acados_solver_sfunction_mls_mpc.o: in function `mdlTerminate': 
C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/acados_solver_sfunction_mls_mpc.c:313: undefined reference to `mls_mpc_acados_free_capsule'
cc: C:/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/slrealtime/target/supportpackage/qnx710//host/win64/x86_64/usr/bin/x86_64-pc-nto-qnx7.1.0-ld caught signal 1
simulation_mpc.mk:235: recipe for target 'C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/simulation_mpc_slrealtime_rtw/simulation_mpc' failed
make: *** [C:/Files/Masterarbeit/Simulation_acados/MPC/c_generated_code/simulation_mpc_slrealtime_rtw/simulation_mpc] Error 1

I already included the header directories in the include/ folder. And most of these undefined references seem to come from the header include/acados_c/ocp_nlp_interface.h. Although this header is included in the directories, I don’t see the generated s-function acados_solver_sfunction_mls_mpc.c including this header at the beginning.

Is there something else I should include or perhaps some settings went wrong?

Thank you for the help :pray:
Shawn