Bug with Visual Studio Compiler in Matlab

Hi :wave:

I successfully installed Acados using Visual Studio 2019 on Windows, but when I tried running the “minimal_example_ocp.m” example, I encountered the following error:

*Error using mex*
*MEX cannot find library 'acados_ocp_solver_pendulum', specified with the -l option.*
* MEX searched for a file with one of the following names:*
* libacados_ocp_solver_pendulum.lib*
*acados_ocp_solver_pendulum.lib*
* Verify the library name is correct. If the library is not*
* on the existing path, specify the path with the -L option.*
*Error in make_mex_pendulum (line 134)*
*            mex(FLAGS, LDFLAGS, COMPDEFINES, COMPFLAGS, acados_include, template_lib_include, external_include, blasfeo_include, hpipm_include,...*

*Error in pendulum_mex_solver (line 47)*
*            make_mex_pendulum();*

*Error in AcadosOcpSolver (line 71)*
*            obj.t_ocp = mex_solver();*

*Error in acados_ocp (line 41)*
*    solver = AcadosOcpSolver(ocp, output_dir);*

*Error in minimal_example_ocp (line 113)*
*ocp_solver = acados_ocp(ocp_model, ocp_opts, simulink_opts);*

Upon investigation, I found that the file “acados_ocp_solver_pendulum.lib” was located in a subfolder with the same name inside the c_generated_code directory. After manually moving the file to the correct location, the examples were able to run successfully.

How can I resolve this issue without needing to manually move files?

Best regards,
Anthony

Hi Anthony,

the files make_mex_*.m and liacados_ocp_solver_* should be in the same directory, namely the subfolder c_generated_code of the main example folder.
The mex command that errors for you should have the argument template_lib_path defined as the full path to that c_generated_code folder.

Can you verify of all of this is the case?
It should of course not be required to move the generated files around.

Best,
Jonathan

Hi Jonathan,
I tested the example in the race_cars folder, and the same error appeared.




Thanks,
Anthony