2
$\begingroup$

The CCompilerDriver documentation explains that to use visual studio express on 64-bit targets, it's necessary to install the windows SDK after installing visual studio. I have done this, first installing visual studio express 2010 and then installing v7.1 of the windows SDK. However, I still have a problem due to a missing LIBCMT.LIB

Compiler`$CCompilerOptions={"ShellOutputFunction"->Print};
cFun=Compile[{{x}},x^2, CompilationTarget->"C"];
C:\Users\lev\AppData\Roaming\Mathematica\ApplicationData\CCompilerDriver\BuildFolder\lev-think-5052\Working-lev-think-5052-7032-1>call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 

Setting SDK environment relative to C:\Program Files\Microsoft SDKs\Windows\v7.1\.
Targeting Windows 7 x64 Debug

Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

compiledFunction0.c
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:compiledFunction0.dll 
/dll 
/implib:compiledFunction0.lib 
/implib:C:\Users\lev\AppData\Roaming\Mathematica\ApplicationData\CCompilerDriver\BuildFolder\lev-think-5052\Working-lev-think-5052-7032-1\compiledFunction0.lib 
"/LIBPATH:C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\lib" 
"/LIBPATH:C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Libraries\Windows-x86-64" 
ml64i3m.lib 
/out:C:\Users\lev\AppData\Roaming\Mathematica\ApplicationData\CCompilerDriver\BuildFolder\lev-think-5052\Working-lev-think-5052-7032-1\compiledFunction0.dll 
compiledFunction0.obj 
LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'

Has anyone managed to get this configuration working? How about with visual studio express 2008 and v7.0 of the SDK?

It took me several tries to get even this far, because I made the mistake of letting windows update install SP1 for visual studio express and this prevented installing the SDK, and I had had uninstall and reinstall everything a few times (it's not possible to simply uninstall SP1), so it's possible I've messed up my installation somehow. I can see that there is a LIBCMT.LIB in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib which I presume is a 32-bit version of the library and not what the linker is looking for in this case.

$\endgroup$
9
  • 2
    $\begingroup$ Without being able to give a solution, I would like to mention that when I tried it on Windows 7 64 bit it was enough to install the Windows SDK (making sure to select the command line compiler for installation). Without any additional configuration and without installing Visual Studio Express, Compile[..., CompilationTarget -> "C"] is working correctly. $\endgroup$
    – Szabolcs
    Commented Feb 19, 2012 at 16:28
  • $\begingroup$ @Szabolcs I'm going to try uninstalling everything and then installing only the Windows SDK, since this works for you. Do you have v7.0 or v7.1? $\endgroup$
    – Lev Bishop
    Commented Feb 19, 2012 at 16:41
  • $\begingroup$ Unfortunately I don't have that computer here, so I can't check. But I have downloaded the latest version less than a month ago. I am not knowledgeable about these things, I just thought it might be useful for you if I mention that it worked without extra setup for me. $\endgroup$
    – Szabolcs
    Commented Feb 19, 2012 at 16:43
  • 1
    $\begingroup$ @Szabolcs I did as you suggested and installed only v7.1 of the SDK and Compile[..., CompilationTarget -> "C"]seems to be working correctly now, so thanks. I'd still be interested if anybody knows if it's possible to have this working with visual studio also installed, though. $\endgroup$
    – Lev Bishop
    Commented Feb 19, 2012 at 16:56
  • 2
    $\begingroup$ 64 bit libraries are in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64, one directory level deeper. Try adding this path you the LIB environment variables. When VS is installed, the INCLUDE and LIB paths are not set system-wide; instead, there are .bat files that set up specific environments. These do not apply to Mathematica, so I think your best bet is to set the environment vars by hand. (For the SDK, set LIB to something like C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\x64). $\endgroup$ Commented Feb 20, 2012 at 9:53

2 Answers 2

2
$\begingroup$

Just thought I'd share.

I had the same problem after re-installing VS2010 Ultimate (I also have 2008).

To fix it, I copied the following

  • libcmt.lib
    libcmt.pdb
    libcmtd.lib
    libcmtd.pdb
    oldnames.lib

from C:\Program Files\Microsoft Visual Studio 11.0\VC\lib
to C:\Program Files\Microsoft Visual Studio 10.0\VC\lib

Hope this helps someone.

$\endgroup$
1
  • $\begingroup$ Well, this could just as easily break VS 10 (or rather, the programs compiled with it). The link libraries are version-specific. If your program crashes, that would be the least of your problems. Subtle bugs and unpredictable behavior are a more likely result. $\endgroup$ Commented Jan 7, 2015 at 14:55
0
$\begingroup$

I had the same issue. Repairing or reinstalling VS 2010 express didn't work either. Most of the lib files where missing. I ended up installing on another pc and copying the missing files. Then it worked like a charm. Hope this helps.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.