VS 2010 express compiler Matlab shared libraries

3 views (last 30 days)
Hello, I'm following this tutorial <http://www.mathworks.com/support/solutions/en/data/1-F9VB0V/index.html?product=CO&solution=1-F9VB0V> , but after all dependencies been satisfied I get this error:
fatal error LNK1181: cannot open input file 'kernel32.lib'
Any Ideas?
  4 Comments
Mark Mikofski
Mark Mikofski on 28 Aug 2012
Edited: Mark Mikofski on 29 Aug 2012
  • kernel32.lib on x64 is not necessarily an x86 library. Search for it and you will find it in both "Program Files (x86)" and "Program Files". On MS-Windows, "32" is a legacy suffix. For example "system32" is the x64 folder and "sysWOW64" is actually the x86 folder, which literally means "system32 Windows on Windows x64"
  • See WoW64 on Wikipedia
  • also use ...
mexConf = mex.getCompilerConfigurations
mexConf.Details.LinkerFlags
... and you will see kernel32.lib linked.
mex -setup
... presumably because it is not officially supported anymore. The "professional" versions are supported, as is Windows SDK 7.1.
Mark Mikofski
Mark Mikofski on 28 Aug 2012
One more note:
I just compiled a file with the Windows 7.1 SDK compiler and compared it with the original compiled with VS10 Express, and the files are identical byte for byte. This is not super surprising because previously VS10 Express only worked on x64 with the Windows 7.1 SDK, and MATLAB seems to state that Windows 7.1 SDK is inside of VS10 Express, so maybe they are nearly one and the same now? I'm going to think of this as an improvement.

Sign in to comment.

Answers (1)

Mark Mikofski
Mark Mikofski on 29 Aug 2012
Edited: Mark Mikofski on 29 Aug 2012
From your link it appears that you are using MATLAB 2011a on Windows 7 x64. If this is not true please respond with your version of MATLAB. Nevertheless I will address issues for both prior to 2012a and post and for both x86 and x64.
  1. Your problem may be related to Microsoft KB 2519277, if you had previously installed Microsoft Visual C++ 2010 Express (VS 2010 Express) and Windows SDK 7.1, and then later applied the Service Pack 1 Compiler Update. The solution is to download and install this update: VC-Compiler-KB2519277.exe.
  2. You may not have Windows SDK 7.1 installed at all. According to this list of supported compilers for MATLAB 2011a (x64), MATLAB 2011a only supports VS 2010 Express if it used with Windows SDK 7.1. Here is a nice step-by-step solution posted by MathWorks. Note: You may still need to install the Visual C++ SP1 Compiler Update for Windows SDK 7.1. See the link to KB 2519277 above.
  3. If you have MATLAB 2012a or later, then the problem is that VS 2010 Express is not supported in MATLAB 2012a or later, although Microsoft Visual C++ 2010 Professional is still supported, and Windows SDK 7.1 is now supported by itself. See the list of supported compilers for MATLAB 2012a (x64). You do not need VS 2010 Express.
  4. Windows x86 versions of MATLAB 2011b and earlier do not require Windows SDK 7.1, that is they work with VS 2010 Express. However Windows x86 versions of MATLAB 2012a and later only use Windows SDK 7.1, similar to the x64 versions, and do not require VS 2010 express. Unfortunately there is an issue installing Windows SDK 7.1 when VS 2010 SP1 has already been installed which is also described in KB 2519277 (see above). The preferred method of installation is (1) Visual C++ 2010 (Express or Professional), (2) Windows SDK 7.1, (3) Visual C++ 2010 SP1, (4) the Visual C++ SP1 Compiler Update for Windows SDK 7.1. If you try to install Windows SDK 7.1 after installing SP1, then you will get a "fatal error" when it attempts to install the C++ compilers. Ugh! The workaround is to uncheck the "C++ compilers" box and rerun the installation. Then after the installation is complete run the Visual C++ SP1 Compiler Update for Windows SDK 7.1.
Please consult the appropriate list of supported compilers for all x86 versions of MATLAB. However
  1 Comment
Mark Mikofski
Mark Mikofski on 29 Aug 2012
Also note: You are not required to install the Visual C++ 2010 SP1 update.

Sign in to comment.

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!