24
$\begingroup$

The new Visual Studio is out since a week and I tried to get it to work with Mathematica (versions 11.0 and 11.1). However, the usual tricks for working with a new VS version fail here.

Related seems to be the remark made on Microsoft's MSDN blog:

Since we have removed the VS150COMNTOOLS registry key to support the new world where multiple VS instances of the same product can be installed side-by-side on the same machine, we know that many build systems and tools have relied on this in the past and the new options are not an identical replacement. We are actively working with library developers and others with builds that depend on the VC++ compiler tools, and we are open to further feedback to help refine and improve upon the solutions mentioned above. Please share any feedback you have in the comments or feel free to send more detailed suggestions to [email protected].

Anyone tried VS 2017 and succeeded in getting it to work with Compile?

$\endgroup$
12
  • $\begingroup$ CCompilerDriver does not support VS2017. I think the changes in the new VS (as you mentioned) were drastic enough where there will be need to be changes from Mathematica's end to at least easily get them to work together. $\endgroup$
    – ktm
    Mar 15, 2017 at 13:16
  • $\begingroup$ @user6014 I'm not too sure of that. It looks like the changes concern only things as path finding/setting. That should be doable or are you aware of any other fundamental issues? $\endgroup$ Mar 15, 2017 at 13:20
  • 1
    $\begingroup$ @Szabolcs I tried a few things but they didn't work. I guess installing an older VS version is the current workaround, but I don't like to have several massive installations in parallel. $\endgroup$ Mar 15, 2017 at 21:40
  • 5
    $\begingroup$ Temporary workaround: To use a C++ compiler with Mathematica, it seems to be sufficient to install this (no GUI needed, safe to uncheck all components at installation). Take the 2015 version of course. It seems to coexist just fine with VS2017, so you can have it installed until Mathematica will work with VS2017. $\endgroup$
    – Szabolcs
    Mar 22, 2017 at 10:00
  • 2
    $\begingroup$ A small correction: It is not safe to uncheck all components. If you do not already have a Windows SDK installed, do check this component during the installation of the build tools. In my case everything worked because I already had it installed. $\endgroup$
    – Szabolcs
    Apr 3, 2017 at 11:32

1 Answer 1

7
$\begingroup$

Since version 11.2.0, the CCompilerDriver package has been updated and supports Microsoft Visual Studio 2017.

As mentioned in the question, starting with VS2017 the VSXXXCOMNTOOLS registry keys or environment variables are no longer provided, so a new mechanism was needed so that the compiler installation can be detected. This is based on Microsoft's vswhere locator tool.

If a full VS installation with the IDE is not needed, the Visual Studio Build Tools can also be used.

$\endgroup$
14
  • $\begingroup$ Works flawlessly for me. Thanks! Is there something that users of older Mathematica version can do, using vswhere? $\endgroup$ Nov 19, 2017 at 15:55
  • $\begingroup$ Could please explicitly point out the minimum components of Visual Studio 2017 that need ticking when installing? $\endgroup$ Mar 16, 2018 at 7:00
  • $\begingroup$ @ΑλέξανδροςΖεγγ I would try to only install the build tools: visualstudio.com/downloads/#build-tools-for-visual-studio-2017 I haven't tried this myself though. I still use the 2015 one. $\endgroup$
    – Szabolcs
    Apr 1, 2018 at 17:50
  • $\begingroup$ @SjoerdC.deVries You got it working just with the updated 11.3 or did additional workaround? Please, edit your question with an UPDATE to include the version of your code with the output f using Needs["CCompilerDriver`"] CCompilers[] . I will like to see if your compiler recognizes the VS 2017 and how a compiled code is outputed. $\endgroup$ May 1, 2018 at 13:27
  • $\begingroup$ @Szabolcs I installed the built tools and made no difference. $\endgroup$ May 1, 2018 at 13:30

Your Answer

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

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