From: Hannes on
Hi,

could you give any further details, how the final mex-compilation succeeded?

I have successfully compiled a GotoBLAS2 library and downloaded pre-compiled lapack.lib and libf2c.lib (at http://icl.cs.utk.edu/lapack-for-windows/clapack/index.html#build%29.). I successfully compiled Levmar in C using MS Visual Studio 2010 Express. So, lmdemo.exe runs perfectly well.

However, when trying to make the levmar.mexw32 file, I obtain the following errors, both when using 'mex' from within Matlab and Visual Studio, typing 'nmake /f Makefile.w32' (Makefile.w32 attached at the very bottom of this message):

#####################################################
>> mex -I.. -O -LC:\src\levmar-2.5\ -LC:\src\blaslapacklibs\ levmar.c -llevmar -llibgoto2 -llapack -llibf2c
Writing library for levmar.mexw32
Axb.obj .text: undefined reference to '__imp__free'
Axb.obj .text: undefined reference to '__ftol2_sse'
Axb.obj .text: undefined reference to '__imp____iob_func'
Axb.obj .text: undefined reference to '__imp__exit'
lm.obj .text: undefined reference to '__imp___finite'
lmblec.obj .text: undefined reference to '___security_cookie'
lmblec.obj .text: undefined reference to '@__security_check_cookie@4'
misc.obj .text: undefined reference to '_sgemm_'
misc.obj .text: undefined reference to '_dgemm_'
.text: undefined reference to '_xerbla_'
.text: undefined reference to '_strmm_'
.text: undefined reference to '_strsm_'
.text: undefined reference to '_sswap_'
.text: undefined reference to '_snrm2_'
.text: undefined reference to '_dtrmm_'
.text: undefined reference to '_dtrsm_'
.text: undefined reference to '_dswap_'
.text: undefined reference to '_dnrm2_'
.text: undefined reference to '_sdot_'
.text: undefined reference to '_sgemv_'
.text: undefined reference to '_sscal_'
.text: undefined reference to '_ddot_'
.text: undefined reference to '_dgemv_'
.text: undefined reference to '_dscal_'
.text: undefined reference to '_dsyrk_'
.text: undefined reference to '_dger_'
.text: undefined reference to '_ssyrk_'
.text: undefined reference to '_sger_'
.text: undefined reference to '_scopy_'
.text: undefined reference to '_strmv_'
.text: undefined reference to '_isamax_'
.text: undefined reference to '__chkstk'
.text: undefined reference to '_dcopy_'
.text: undefined reference to '_dtrmv_'
.text: undefined reference to '_idamax_'
.text: undefined reference to '_srot_'
.text: undefined reference to '_drot_'
.text: undefined reference to '_dsyr_'
.text: undefined reference to '_ssyr_'
.text: undefined reference to '__imp__perror'
.text: undefined reference to '__imp__ftell'
.text: undefined reference to '__imp__freopen'
.text: undefined reference to '__imp___errno'
.text: undefined reference to '__imp__fseek'
.text: undefined reference to '__imp__fflush'
.text: undefined reference to '__imp__fputs'
.text: undefined reference to '__imp__putc'
.text: undefined reference to '__imp__sprintf'
.text: undefined reference to '__imp__fopen'
.text: undefined reference to '__imp__access'
.text: undefined reference to '__imp__tmpfile'
.text: undefined reference to '__imp__rewind'
.text: undefined reference to '__imp__signal'
.text: undefined reference to '__imp__abort'
.text: undefined reference to '__imp__remove'
.text: undefined reference to '__imp__atoi'
.text: undefined reference to '__imp__fread'
.text: undefined reference to '__imp__fwrite'

C:\PROGRAMME\MATLAB\R2006A\BIN\MEX.PL: Error: Link of 'levmar.mexw32' failed.

??? Error using ==> mex
Unable to complete successfully
###################################################

Any ideas are highly appreciated!

Thanks,
Hannes


###################################################
Makefile.w32:
###################################################

#
# Windows Makefile for MATLAB interface to levmar
#

MEX=mex
MEXCFLAGS=-I.. -O #-g
# WHEN USING LAPACK, CHANGE THE NEXT TWO LINES TO WHERE YOUR COMPILED LAPACK/BLAS & F2C LIBS ARE!
LAPACKBLASLIBS_PATH=C:\src\blaslapacklibs
F2CLIBS_PATH=$(LAPACKBLASLIBS_PATH) # define appropriately if not identical to LAPACKBLASLIBS_PATH


INTFACESRCS=levmar.c
# Exluded by Hannes: $(F2CLIBS_PATH)/libF77.lib $(F2CLIBS_PATH)/libI77.lib
LAPACKLIBS=$(LAPACKBLASLIBS_PATH)/libgoto2.lib $(LAPACKBLASLIBS_PATH)/lapack.lib $(F2CLIBS_PATH)/libf2c.lib

LIBS=$(LAPACKLIBS)

dummy: $(INTFACESRCS)
$(MEX) $(MEXCFLAGS) $(INTFACESRCS) ../levmar.lib $(LIBS)

clean:
-del levmar.mexw32

depend:
makedepend -f Makefile $(INTFACESRCS)

# DO NOT DELETE THIS LINE -- make depend depends on it.
From: Hannes on
p.s.: I am using Matlab version 7.2.0.232 (R2006a) on Windows XP.
Selected compiler:
[1] Lcc C version 2.4.1 in C:\PROGRAMME\MATLAB\R2006A\sys\lcc