I am having the exact same problem as https://www.mathworks.com/matlabcentral/answers/172057-error-using-mex-line-206-unable-to-complete-successfully
I installed matlab2011a (32 bit) in windows10 (64bit).
I tried to install Fast Model Predictive Control Using Online Optimization from http://stanford.edu/~boyd/fast_mpc/ which contain a Mex solver. During the setup step, I am supposed to compile a c file fmpc.c using
mex fmpc_sim.c libmwblas.lib libmwlapack.lib
But for whatever reason, it says there are a bunch of undefined references. I have followed the instructed nearly exactly as stated, what could be going wrong? How do I solve this reference error?
EDU>> mex -setupWelcome to mex -setup. This utility will help you set up a default compiler. For a list of supported compilers, see http://www.mathworks.com/support/compilers/R2011a/win32.html Please choose your compiler for building MEX-files: Would you like mex to locate installed compilers [y]/n? ySelect a compiler: [1] Lcc-win32 C 2.4.1 in C:\PROGRA~2\MATLAB\R2011A~1\sys\lcc [0] None Compiler: 1Please verify your choices: Compiler: Lcc-win32 C 2.4.1 Location: C:\PROGRA~2\MATLAB\R2011A~1\sys\lcc Are these correct [y]/n? yTrying to update options file: C:\Users\n\AppData\Roaming\MathWorks\MATLAB\R2011a\mexopts.bat From template: C:\PROGRA~2\MATLAB\R2011A~1\bin\win32\mexopts\lccopts.bat Done . . . ************************************************************************** Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. In the near future you will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9 Building with the -largeArrayDims option enables the new API. ************************************************************************** EDU>> mex fmpc_sim.c libmwblas.lib libmwlapack.libWriting library for fmpc_sim.mexw32 c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_dgemm_' c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_dposv_' c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_dgemv_' c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_daxpy_' c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_dtrtrs_' c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_dtrsv_' c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_dnrm2_' C:\PROGRA~2\MATLAB\R2011A~1\BIN\MEX.PL: Error: Link of 'fmpc_sim.mexw32' failed. ??? Error using ==> mex at 208Unable to complete successfully.
Installation instructions for fast_mpc ———————————————————————–
fast_mpc is written in C with a mex interface to MATLAB. Before installation, make sure that BLAS and LAPACK libraries are installed in your machine.
1. Unpack the fast_mpc files, or get them individually.
2. Start MATLAB and cd to the directory containing the source files.
3. At the MATLAB command prompt type
>> mex -setup and enter the number corresponding to the template option gccopts.sh.
4. Compile fmpc_sim.c using
>> mex fmpc_sim.c On some machines you may need to specify the libraries >> mex fmpc_sim.c -lblas -llapack If you want to link your own libraries, you can. For example, to link the libraries libacml.a, libacml_mv.a, and libgfortran.a in the directory /opt/acml/lib, use the option '-L' to specify the library search path and the option '-l' to specify the individual libraries, as in >> mex fmpc_sim.c -L/opt/acml/lib -lacml -lacml_mv -lgfortran
5. If fmpc_sim.c compiles successfully, do the same with fmpc_step.c.
6. Test the installation by running the masses_example script
>> masses_example which will run MPC, for 100 iterations, on the masses example in the paper, using mpc_step. You should see reports from each iteration printed to your screen. The last one, for example, should look like iteration step rd rp 0 0.3874 1.09294e+01 1.27108e+00 1 1.0000 1.54052e+00 1.39748e-14 2 1.0000 2.98332e-01 1.40216e-15 3 1.0000 1.16741e-02 1.02482e-15
The average cost is: 5.683200
Test mpc_sim by running the script randsys_example.
Best Answer