Take the 2-minute tour ×
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.

Needs["CCompilerDriver`"]

CCompilers[Full]
CCompilers[] 

returns

{}  
{}

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

$ContextPath//First

returns

"CCompilerDriver`"

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 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 at 14:55
    
@halirutan Oh, I had no trouble running VS 2012 and compile str8 after install :) –  Sektor Feb 4 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 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 at 16:33
show 2 more comments

1 Answer 1

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 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 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 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 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 at 19:54
show 3 more comments

Your Answer

 
discard

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.