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.
Compile[..., CompilationTarget -> "C"]
is working correctly. $\endgroup$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$C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64
, one directory level deeper. Try adding this path you theLIB
environment variables. When VS is installed, theINCLUDE
andLIB
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 likeC:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\x64
). $\endgroup$