Re: Visual C++ 2010 Express compiler not working with Mathematica 8.0.4
- To: mathgroup at smc.vnet.net
- Subject: [mg124087] Re: Visual C++ 2010 Express compiler not working with Mathematica 8.0.4
- From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
- Date: Sun, 8 Jan 2012 04:26:56 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
On Wed, 28 Dec 2011 10:18:40 -0000, Sly Pandemia <slypandemia at gmail.com> wrote: > Hi, > > I can't get Mathematica 8.0.4 to use the Visual C++ 2010 Express > compiler on Windows 7 64 bit. The CCompilerDriver tutorial explains > that one must install the Windows 7.1 SDK to get the 64-bit compiler, > which I have done, but it is still not working. > > CCompilers[] returns an empty list. > > CCompilers[Full] returns the Intel Compiler and Generic C Compiler, > but not Visual Studio. > > Attempting to use Compile with the option CompilationTarget -> "C" > gives an error message: > CreateLibrary::target: Target system specification "TargetSystemID" -> > Windows-x86-64 is not available for Visual Studio installation > C:\Program Files (x86)\Microsoft Visual Studio 10.0. > > Does anyone have any ideas? > Visual C++ 2010 Express is actually superfluous if you only want to use it as a C compiler for Mathematica or compiling projects from the command line rather than making use of the IDE; the Windows SDK 7.1 is sufficient by itself in this case. I think the most likely explanation for the behaviour you are seeing is that CCompilerDriver realises that the installation in C:\Program Files (x86)\Microsoft Visual Studio 10.0 can only produce 32-bit code (a deliberate limitation of Visual Studio Express and the reason why this does not work with Mathematica on 64-bit computers), but does not look further to find the 64-bit compilers installed with the SDK. If so then you can get around it in several ways: 1. Define $CCompiler = {"Compiler" -> CCompilerDriver`VisualStudioCompiler`VisualStudioCompiler, "CompilerInstallation" -> path}, where path is the installation path you have chosen for the Windows SDK. 2. Install the Windows SDK into C:\Program Files (x86)\Microsoft Visual Studio 10.0\SDK rather than your present choice of installation directory and let it overwrite the 32-bit-only SDK components installed by Visual Studio Express. (Admittedly I am not completely sure whether Visual Studio 2010 Express will still work properly afterwards if you do this.) 3. Remove both Visual Studio Express and the SDK and reinstall the SDK by itself in such a way as it will work with Mathematica. If you like, you can follow the instructions I gave here: http://forums.wolfram.com/mathgroup/archive/2011/Nov/msg00024.html Whichever approach you choose, don't forget to install the SP1 update: http://www.microsoft.com/download/en/details.aspx?id=4422. (Some comments on this step are included in my instructions linked above.)