Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Linking error when compiling mex files with Matlab R2008a

260 views
Skip to first unread message

Hannes

unread,
Feb 3, 2011, 7:49:03 AM2/3/11
to
Hello,
I have followed the instructions outlined below to install Visual Studio 2008 with as the compiler for mex files:
http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/?solution=1-6IJJ3L

I have version r2008a (not r2008b, as in the instructions), and 64 bit windows 7.

Matlab finds the Microsoft Visual C++ 2008, but when I try compiling I get the following error:
LINK : fatal error LNK1181: cannot open input file 'kernel32.lib'

(see full output message below).
Is there some environment variable that should be adjusted, or does anyone have a clue? I have not found the kernel32.lib file on my hard drive.
/Hannes


Full output message:
>> mex -v helloworld.c
This is mex, Copyright 1984-2007 The MathWorks, Inc.

-> Default options filename found in C:\Users\hmogens.EU\AppData\Roaming\MathWorks\MATLAB\R2008a
----------------------------------------------------------------
-> Options file = C:\Users\hmogens.EU\AppData\Roaming\MathWorks\MATLAB\R2008a\mexopts.bat
MATLAB = C:\PROGRA~1\MATLAB\R2008a
-> COMPILER = cl
-> Compiler flags:
COMPFLAGS = -c -Zp8 -GR -W3 -EHs -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_SECURE_SCL=0 -DMATLAB_MEX_FILE -nologo /MD
OPTIMFLAGS = -O2 -Oy- -DNDEBUG
DEBUGFLAGS = -Zi -Fd"helloworld.mexw64.pdb"
arguments =
Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /dll /export:mexFunction /MAP /LIBPATH:"C:\PROGRA~1\MATLAB\R2008a\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /implib:C:\Users\hmogens.EU\AppData\Local\Temp\mex_PEHeLN\templib.x /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
LINKDEBUGFLAGS = /DEBUG /PDB:"helloworld.mexw64.pdb"
LINKFLAGSPOST =
Name directive = /out:"helloworld.mexw64"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------


--> cl -c -Zp8 -GR -W3 -EHs -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_SECURE_SCL=0 -DMATLAB_MEX_FILE -nologo /MD /FoC:\Users\hmogens.EU\AppData\Local\Temp\mex_PEHeLN\helloworld.obj -IC:\PROGRA~1\MATLAB\R2008a\extern\include -IC:\PROGRA~1\MATLAB\R2008a\simulink\include -O2 -Oy- -DNDEBUG -DMX_COMPAT_32 H:\MATLAB\positionering\helloworld.c

helloworld.c
Contents of C:\Users\hmogens.EU\AppData\Local\Temp\mex_PEHeLN\mex_tmp.rsp:
C:\Users\hmogens.EU\AppData\Local\Temp\mex_PEHeLN\helloworld.obj


--> link /out:"helloworld.mexw64" /dll /export:mexFunction /MAP /LIBPATH:"C:\PROGRA~1\MATLAB\R2008a\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /implib:C:\Users\hmogens.EU\AppData\Local\Temp\mex_PEHeLN\templib.x /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib @C:\Users\hmogens.EU\AppData\Local\Temp\mex_PEHeLN\mex_tmp.rsp

Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Users\hmogens.EU\AppData\Local\Temp\mex_PEHeLN\helloworld.obj
LINK : fatal error LNK1181: cannot open input file 'kernel32.lib'

C:\PROGRA~1\MATLAB\R2008A\BIN\MEX.PL: Error: Link of 'helloworld.mexw64' failed.

??? Error using ==> mex at 207
Unable to complete successfully.

0 new messages