MATLAB: Error using mex (line 206) Unable to complete successfully.

error using mex (line 206) unable to complete successfully.

Hello,
1. I installed matlab2013a (32 bit) in windows7 (64bit).
I tried to install Fast Model Predictive Control Using Online Optimization from http://stanford.edu/~boyd/fast_mpc/ which contain C language
I run below command in matlab and got error "Error using mex (line 206) Unable to complete successfully"
Please help
Thank you
>> mex -setup
Welcome 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/R2013a/win32.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~2\MATLAB\R2013a\sys\lcc
[0] None
Compiler: 1
Please verify your choices:
Compiler: Lcc-win32 C 2.4.1
Location: C:\PROGRA~2\MATLAB\R2013a\sys\lcc
Are these correct [y]/n? y
Trying to update options file: C:\Users\MadOpick\AppData\Roaming\MathWorks\MATLAB\R2013a\mexopts.bat
From template: C:\PROGRA~2\MATLAB\R2013a\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/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html
Building with the -largeArrayDims option enables the new API.
**************************************************************************
>> mex fmpc_sim.c
Writing library for fmpc_sim.mexw32
c:\users\madopick\appdata\local\temp\mex_tgby8u\fmpc_sim.obj .text: undefined reference to '_dgemm_'
c:\users\madopick\appdata\local\temp\mex_tgby8u\fmpc_sim.obj .text: undefined reference to '_dposv_'
c:\users\madopick\appdata\local\temp\mex_tgby8u\fmpc_sim.obj .text: undefined reference to '_dgemv_'
c:\users\madopick\appdata\local\temp\mex_tgby8u\fmpc_sim.obj .text: undefined reference to '_daxpy_'
c:\users\madopick\appdata\local\temp\mex_tgby8u\fmpc_sim.obj .text: undefined reference to '_dtrtrs_'
c:\users\madopick\appdata\local\temp\mex_tgby8u\fmpc_sim.obj .text: undefined reference to '_dtrsv_'
c:\users\madopick\appdata\local\temp\mex_tgby8u\fmpc_sim.obj .text: undefined reference to '_dnrm2_'
C:\PROGRA~2\MATLAB\R2013A\BIN\MEX.PL: Error: Link of 'fmpc_sim.mexw32' failed.
Error using mex (line 206)
Unable to complete successfully.

Best Answer

Ahmad - what is the mex call that you are using to build your function? Is it simply
mex fmpc_sim.c
If so, then you must be missing a library (or another C file) that references dgemm, dposv, etc.
The post http://www.mathworks.com/matlabcentral/answers/156072-mex-link-failure-undefined-symbols-for-architecture seems very similar (but is applicable to OS X) and it may be that you have just not included the BLAS and/or LAPACK libraries when compiling the function. See calling lab pack and blas and pay particular attention to the section that deals with Building on Windows Platforms.
Related Question