Unable to compile .mex files with Windows 7 SDK

1 view (last 30 days)
I am running Matlab 2013b on Windows 7 with the Windows 7 SDK. When I try to compile a .mex file, I get the following error:
LINK : fatal error LNK1181: cannot open input file 'kernel32.lib'
I have looked on the Matlab Answers site but the one answer of Renish Ramegowda in April 2013 did not change anything.
I have MS Visual Studio Express 2013 installed, along with the x86 and x64 redistributables for MS VC 2008, 2010, 2012, and 2013. Matlab does not detect any other compiler than the Windows 7 SDK compiler using mex -setup (manually overriding and selecting the others leads to error messages.)
Perhaps this has something to do with the .bat and .stp files in 'R2013b/bin/win64/mexopts.' But I don't have enough knowledge to edit these.
kernel32.lib is present in C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib
The answers to the question of Ziv Mhabary in 2012 are also of no help.
This is the output from the 'mex -v -g ...' command:
-> Default options filename found in C:\Users\jwinebar\Application Data\MathWorks\MATLAB\R2013b
----------------------------------------------------------------
-> Options file = C:\Users\jwinebar\Application Data\MathWorks\MATLAB\R2013b\mexopts.bat
MATLAB = C:\Program Files\MATLAB\R2013b
-> COMPILER = cl
-> Compiler flags:
COMPFLAGS = /c /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 = /Z7
arguments = -I..\target\supp\capp -I..\target\supp\mtli -I..\target\supp\gl2d -I..\target\supp\errt -Izpipo_matlab_environment\c_src\mdstd -I..\..\pipo -Izpipo_matlab_environment\c_src\mwrap -Izpipo_matlab_environment\m_file\make
Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /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 /nologo /manifest /incremental:NO /implib:"C:\Users\jwinebar\AppData\Local\Temp\mex_h3yoN7\templib.x" /MAP:"zpipo_matlab_environment\bin\mpipo.mexw64.map"
LINKDEBUGFLAGS = /debug /PDB:"zpipo_matlab_environment\bin\mpipo.mexw64.pdb"
LINKFLAGSPOST =
Name directive = /out:"zpipo_matlab_environment\bin\mpipo.mexw64"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "zpipo_matlab_environment\bin\mexversion.res"
-> Resource Linker =
----------------------------------------------------------------

Answers (1)

Varun Bhaskar
Varun Bhaskar on 27 Aug 2015
Hi,
The error is most likely due to a corrupt kernel32.dll file.
Reinstalling Windows SDK 7.1 should resolve the issue. Please refer to the following installation instructions:

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!