24

15

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 visualc@microsoft.com.

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

?

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. – ktm – 2017-03-15T13:16:09.737

@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? – Sjoerd C. de Vries – 2017-03-15T13:20:31.443

Either way, could you mail Wolfram and ask them to fix this? – Szabolcs – 2017-03-15T16:48:29.777

@Szabolcs OK, mail has been sent. – Sjoerd C. de Vries – 2017-03-15T20:48:17.603

If you do solve it, please post an answer. I too am going to need this soon ... – Szabolcs – 2017-03-15T20:59:49.527

1@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. – Sjoerd C. de Vries – 2017-03-15T21:40:26.263

5

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.

– Szabolcs – 2017-03-22T10:00:26.3672A 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. – Szabolcs – 2017-04-03T11:32:56.890

@Szabolcs after installing the C++ compiler tools, did you have to modify their directory location? Or simply installing them was good enough? I have recently installed VS 2017, and my Mathematica still gives compile errors. Even after downloading the VS 2015 tools, I still get: "A library could not be generated from the compiled function". Upon typing GetEnviornment[], it shows it's using the VS140COMNTOOLS, So it appears the Mathematica should be able to compile. This has left me really scratching my head. I also installed the latest Windows SDK when installing VS2017. – Luca Pontiggia – 2017-06-01T08:07:54.617

@LucaPontiggia VS2017 is not compatible with Mathematica 11.1. The tools I linked to work, no configuration needed after install. What version of Mathematica do you have? – Szabolcs – 2017-06-01T08:15:03.197

Well I have Mathematica 11.0, which was mentioned in the question. I just understood the tools you linked were a work around this problem - until Mathematica fixes it. If they are indeed incompatible, I guess I will have to uninstall and install VS2015 – Luca Pontiggia – 2017-06-01T08:20:40.067

@LucaPontiggia It's not a workaround. Mathematica is compatible with some compilers, not with others. The one I linked to is the smallest set of tools you can use. You do not need to install the full VS2015, if you only need it for Mathematica. – Szabolcs – 2017-06-02T07:21:39.853