11

On Windows 7 I was using Microsoft Visual C++ as CCompilerDriver. For this, the minimal solution is to install Microsoft .Net and then Microsoft SDK-7.1. There is no need to install Microsoft Visual Studio.

Now I am trying to install Microsoft C++ compiler to work with Mathematica 11 on Windows 10. The difference with Windows 7 is that in Windows 10 Microsoft .Net is a part of OS. Another difference is that SDK-10 does not contain C compiler, as I have found after installation. And it is impossible to install SDK-7.1 as it seems to be incompatible with the pre-installed .Net.

Could anybody propose a minimal solution to install the Microsoft C compiler on Windows 10?

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
  • 2
    I'm voting to close this question as off-topic because it is not about Mathematica or any of the other Wolfram Research software for which questions are accepted on this site. – m_goldberg Sep 11 '16 at 06:57
  • 9
    @m_goldberg I don't agree with you here. Having a C compiler correctly installed is a prerequisite for the correct operation of Mathematica's Compile function with `CompilationTarget->"C" option. We have had many useful questions on that and stuff like CUDA. This is absolutely on-topic as far as I'm concerned. – Sjoerd C. de Vries Sep 11 '16 at 07:28
  • 3
    I would try this: http://landinghub.visualstudio.com/visual-cpp-build-tools I don't know if it works because at the time when I installed this the only solution that seemed to be available was VS Community Edition (i.e. full IDE). So that's what I have, even though I don't use the IDE part. I do agree that this isn't really Mathematica related as the main part of the question seems to be how to avoid installing a full IDE ... – Szabolcs Sep 11 '16 at 07:37
  • @SjoerdC.deVries. Having a working internet connection is prerequisite for using curated data. Would you therefore accept questions about internet connection problems? – m_goldberg Sep 11 '16 at 17:51
  • 1
    Thank you, Szabolcs, for a good advice! I have installed the Standalone Microsoft Visual C++ compiler and Mathematica 11 recognizes it as ccompilerdriver. – Dmitry Garanin Sep 11 '16 at 18:30
  • I have one concern, however. The installation path is "C:\Program Files (x86)\Microsoft Visual Studio 14.0". Does x86 mean that this C++ compiler is 32 bit? On the download site there is no information on whether it is 32 bit or 64 bit. – Dmitry Garanin Sep 11 '16 at 18:43
  • What I am doing is high-performance computations with Mathematica in the area of solid-state physics (look up my papers), and on average using CompilationTarget->"C" gives a x2 speed-up. My question is relevant to Mathematica, and there were many threads of this type in the past. I am surprised that somebody is actively objecting discussing this important question here. – Dmitry Garanin Sep 11 '16 at 18:43
  • 1
    @m_goldberg Well, I've had problems getting past my corporate firewall to access curated data and have been asking questions about that. So, yes. – Sjoerd C. de Vries Sep 11 '16 at 20:45
  • @DmitryGaranin this x86 has nor relationship with the compiler being 32 or 64 bit, as far as I know. – Sjoerd C. de Vries Sep 11 '16 at 20:47
  • @DmitryGaranin What really matters is not whether the compiler itself is 32 or 64-bit executable. The important thing is: does it generate 32 or 64-bit code? If it works with Compile and a 64-bit version of Mathematica then it is definitely able to generate 64-bit code. – Szabolcs Sep 11 '16 at 21:00
  • 1
    @DmitryGaranin Please post an answer to your own question. I couldn't post it because I did not try that this works. It is useful to document that it indeed does. – Szabolcs Sep 11 '16 at 21:01
  • 1
    This question would 100% be better on some other stack site. Just because it is a valid question doesn't make it on topic here – Jason B. Sep 12 '16 at 01:26
  • Maybe your LIB directory points to a 64-bit user32.lib and you're trying to compile a 32-bit executable, or the other way around. The compiler output (x86 or x64) must match the linked libraries – xorcus Oct 01 '18 at 10:19

1 Answers1

4

I have installed the Standalone Microsoft Visual C++ compiler, as suggested by Szabolcs, landinghub.visualstudio.com/visual-cpp-build-tools. It is getting recognized by Mathematica 11 and working on Windows 10.

Note that you don't have to install Microsoft .NET since on Windows 10 it is a part of OS.

  • After install Encounter with a problem with Mathematica 11.1 on Windows 10. CreateExecutable::cmperr: Compile error: LINK : fatal error LNK1181: cannot open input file 'user32.lib' – HyperGroups Aug 28 '17 at 05:14
  • Unfortunately, this solution doesn't seem to work for me either (I have Mathematica 10.2 on Win 10 64 bit). I also followed Szabolcs solution for making Mathematica 10.2 recognize the VisualStudio Compiler in "VisualStudioCompiler.m": here. Funny enough, if I execute CCompilers[] Mathematica shows that it has found the VS compiler. But it says there "CompilerName" -> Automatic". Anyway trying to compile anything with CompilationTarget->"C" or the "hello world"-example fails. – Quit007 Oct 08 '17 at 19:39