Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm running Mathematica 9 on a 64 bit Windows 8.1 laptop. I'm having no luck getting C compilation to work.





The package did load successfully, as $Packages shows CCompilerDriver entries and




I have the following compilers installed:

  • Microsoft Visual Studio Professional 2013
  • Intel C++ Composer XE
share|improve this question
Is it possible for you to install MS VS 2012 and try again to set up the compiler ? – Sektor Feb 4 '14 at 14:54
AFAIK under Windows the PATH to the Visual Studio compiler is not set system wide. Can you try to add VC to your PATH and restart Mathematica? – halirutan Feb 4 '14 at 14:55
@halirutan Oh, I had no trouble running VS 2012 and compile str8 after install :) – Sektor Feb 4 '14 at 14:59
@halirutan I don't remember the details, but it does not find the location of VS using PATH. I think it uses another environment variable ... – Szabolcs Feb 4 '14 at 16:28
I don't have access to Windows at this moment, but I looked at the VS compiler driver, and it looks like it find the location of the compiler based on the VS110COMNTOOLS environment variable. There are lines like installPath["2012"] := installPathFromEnvironment["VS110COMNTOOLS"] for 2005, 2008, 2010 and 2012, but not 2013. I don't know how your version of VS indicates its location, but you could try CCompilerDriver`VisualStudioCompiler`Private`installPath["2013"] := ... or whatever is appropriate for you compiler, and trying again. – Szabolcs Feb 4 '14 at 16:33

2 Answers 2

Visual Studio 2013 is not supported out of the box by Mathematica 9.0.1. To fix this,

  • Navigate to AddOns\Applications\CCompilerDriver within the Mathematica installation directory.

  • Back up VisualStudioCompiler.m as we're going to modify it.

  • Open the file and search for the line starting with installPath["2012"]

  • Add the following line below it:

    installPath["2013"] := installPathFromEnvironment["VS120COMNTOOLS"]
  • Search for the line $VisualStudioVersions = {"2012", "2010", "2008", "2005"} and add "2013" at the beginning, like this:

    $VisualStudioVersions = {"2013", "2012", "2010", "2008", "2005"}
  • Save the file, restart Mathematica, and try again.

share|improve this answer
Well, it seems that this was a hit and run question. The OP has disappeared. If anyone can test if this solution is working, please comment so we can finalize or delete the answer. – Szabolcs Feb 5 '14 at 18:15
I can confirm that this does not fix the issue. Think I will have to reinstall VS2012 now, crap! – RunnyKine Feb 8 '14 at 19:39
@RunnyKine Before you do that, let's experiment a bit ... does the VS120COMNTOOLS environment variable exist on your system? What is its value? – Szabolcs Feb 8 '14 at 19:43
It exists, I can't see the full value but it's C:\Program Files (x86)\Microsoft Visual Studio 12.0 ... – RunnyKine Feb 8 '14 at 19:50
@RunnyKine OK, did you actually edit the file I referenced in the post, the way I described? (Make a backup of the original and put the backup in some other directory.) If not, please try actually editing, and make one more change: look up the line starting with $VisualStudioVersions and add "2013" at the beginning of that list. Let's see if it works when both changes are done. – Szabolcs Feb 8 '14 at 19:54

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

  • In the Mathematica installation folders, go to SystemFiles / Components / CCompilerDriver
  • Make a backup copy of VisualStudioCompiler.m (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

share|improve this answer
I fail to see how that's different than the previous answer. – Sektor Aug 19 at 5:28
My reply was posted per another's request elsewhere. It addresses VSP 2015 and not 2013, and the environment variable is different. It also points out the secondary installation that makes Mathematica recognize VSP. – bcolletti Aug 19 at 6:09
@Sektor I asked bcolletti over on Wolfram Community to post information if he gets this working. One difference that might trip up some users is that VS2015 uses VS140COMNTOOLS because they skipped version number 13. I didn't update my answer because I didn't have VS2015 to test with. – Szabolcs Aug 19 at 9:22
@Sektor Another difficulty that's addressed is editing write-protected files on Windows. While editing the other (community wiki) answer would have been a better solution, perhaps the system won't allow new members or low-rep members to edit? Generally, "community wiki" means that editing is welcome (and I thought it also means that the system allows all users to do so). – Szabolcs Aug 19 at 9:30
@Szabolcs Yes, I read the answer. For me -- it brings nothing new to the table assuming knowledge of your previous answer. That is probably not the case for everyone as I had to set up MinGW(GCC) and VS15 compilers (close to) a month ago on Windows machine. About the write-protected files -- That's not related to Mathematica, I think. – Sektor Aug 19 at 10:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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