Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
2  
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. –  Szabolcs Feb 19 '12 at 16:28
    
@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? –  Lev Bishop Feb 19 '12 at 16:41
    
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. –  Szabolcs Feb 19 '12 at 16:43
1  
@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. –  Lev Bishop Feb 19 '12 at 16:56
2  
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). –  kkm Feb 20 '12 at 9:53
show 4 more comments

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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