Message Boards Message Boards

6 Replies
2 Total Likes
View groups...
Share this post:

C Compiler: Recognizing Visual Studio 2015

Posted 9 years ago

Re Mathematica 10.2 under Windows 8.1.

I have VS 2015 (Community Edition, installed but CCompilers@Full returns the Intel and GCC compilers. I think it's because of the following but am not sure...

Stack Exchange postings suggest that I must modify 10.2\SystemFiles\Components\CCompilerDriver\VisualStudioCompiler.m. Sure enough, installPath["2015"] isn't there and so I suppose I need a line similar to:

installPath["2013"] := installPathFromEnvironment["VS120COMNTOOLS"]

If so, "2013" becomes "2015" but what does "VS120COMNTOOLS" become? Or am I barking up the wrong tree?

Thanks. Bruce

POSTED BY: Bruce Colletti
6 Replies
Posted 9 years ago

Here's how to get Mathematica 10.2 to recognize MS Visual Studio 2015's C compiler (Windows 8.1).

• In the Mathematica installation folders, go to SystemFiles / Components / CCompilerDriver

• Make a backup copy of VisualStudioCompiler.m (for any disaster recovery)

• Open VisualStudioCompiler.m

• Scroll to $VisualStudioVersions and add "2015" to the list

• Scroll to installPath["2013"] and after it, include this new line

                installPath["2015"] := installPathFromEnvironment["VS140COMNTOOLS"]

These hiccups bit me:

• Although I could edit VisualStudioCompiler.m, it wouldn't save to the above folder

• Instead, save it elsewhere and then copy it into the above folder

• It's not enough to simply install VS2015 -- once installed, within it you must yet install the C++ compiler

• Once the C++ compiler is installed, open Mathematica and run:


• You should see Visual Studio in the output list -- you're good to go

A big "Thank You" to those who led me to this solution.



POSTED BY: Bruce Colletti

I think there is very little risk to trying this out, just make sure to create a backup of the file you modify. You can run a text editor as administrator, then use it to open and edit the file.

There are good reasons why WRI discourages people from modifying installation files: doing so can break things, sometimes in very subtle ways, and people might not even realize that the problems they see could be because they modified something several months ago and then forgotten about it. Then this creates an additional support burden for WRI. So they certainly don't want such modifications to become commonplace in the community.

However, in this specific case, I wouldn't worry. Just make a backup of the file and do keep in mind that you made this particular modification.

POSTED BY: Szabolcs Horvát
Posted 9 years ago

Looks like I need to wait 'til Monday. No matter what text editor I use, the modified *.m file just won't save under Windows 8.1.

Wolfram Research is too clever to outwit.

POSTED BY: Bruce Colletti
Posted 9 years ago

Thanks, Szabolcs. You're right -- "VS140COMNTOOLS" is correct, per the environment variable that I've just learned to access (Control Panel / System / System / AdvSystemSettings / AdvancedTab / EnvironmentVariables then scroll down in the box).

Now I need to unprotect VisualStudioCompiler.m so that I can edit it. Years ago, Wolfram Tech Support said "Check with us first before editing *.m files" so I'll wait 'til Monday to do so. I'll then post to Stack Exchange, as you requested (yes, that was indeed the thread -- I now see that you had participated in it).

POSTED BY: Bruce Colletti

If you get it working, consider editing the StackExchange post with the correct details for VS 2015 (the "community wiki" designation of that answer means that you are welcome to do this). Other people who use VS 2015 will appreciate it. I do not have this software myself so I cannot test, I can only guess at the correct setup.

POSTED BY: Szabolcs Horvát

The procedure is described here:

This is probably what you referred to, but it's better to actually post the link.

VS120COMNTOOLS is an environment variable, so you need to check what similarly named environment variables exist on your system.

VS 2013 has version number 12.0 and VS 2015 has version number 14.0. So I suppose it must be VS140COMNTOOLS.

Microsoft seems to be supersititious because they skipped version 13.0.

POSTED BY: Szabolcs Horvát
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract