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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Mathematica does not recognize any C compiler on my computer. I run Mathematica on Windows 7. I've tried to make sure various C compilers are installed on my computer, but I'm not sure how to get Mathematica to recognize the installation.

If the compiler is installed correctly, should Mathematica automatically recognize it, or do I have to point Mathematica to a very specific folder to find it?

I edited this post according to some of the comments below by @Szabolcs and @. I've been through , and step 2 appears to fail.

I've already been to, and I installed Microsoft Windows SDK v7.1 for Windows 7 and .NET Framework 4 for xI64.

I also got the Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1:

Please forgive me for not knowing how to check to see if the compiler is working. I simply don't even know where to start with Visual Studios and all that.


gives the following output:

{{"Name" -> "Intel Compiler", 
  "Compiler" -> CCompilerDriver`IntelCompiler`IntelCompiler, 
  "CompilerInstallation" -> None, 
  "CompilerName" -> Automatic}, {"Name" -> "Generic C Compiler", 
  "Compiler" -> CCompilerDriver`GenericCCompiler`GenericCCompiler, 
  "CompilerInstallation" -> None, "CompilerName" -> Automatic}}

I get the following error when I try to compile:

CreateLibrary::instl: The compiler installation directive "CompilerInstallation" -> C:\Program Files (x86)\Microsoft Visual Studio 10.0\SDK does not indicate a usable installation of Visual Studio. >>

My question is similar to this question thread, but I don't have enough reputation to ask on that thread.

I also have "gcc" show up in a search in various folders under Python27 and MinGW, but Mathematica doesn't seem to know about it. I don't care which compiler I use; I just want an easy installation.

I spent a day trying all sorts of stuff mentioned on various forums, but nothing is working. Why does Mathematica not come out of the box with a working compiler?

share|improve this question
You should not change $CCompilers or set anything else special. Please restart Mathematica, and evaluate Needs["CCompilerDriver`"]; CCompilers[] (in a fresh kernel) and post what it returns. Also try ` Compile[x, x, CompilationTarget -> "C"]. Actually iy would be best if you went through those 4 steps I posted [here]( and posted the results. Again: don't change things like $CCompiler` before testing!! Can you start a Windows SDK Command Prompt and test manually that the compiler works (cl.exe)? – Szabolcs May 13 '12 at 6:38
If you have a 64-bit system, you have two free choices: 1. The 64 bit command line compiler from the Windows 7 SDK. This should 'just work' after installation. (It is not necessary to install Visual Studio, just the compiler from the SDK!!) 2. a 64-bit MinGW: this will require manual setup using the generic compiler driver (there are step by step instructions specifically for this toolchain in the docs), and is a lot more trouble to get working. – Szabolcs May 13 '12 at 6:40
@Szabolcs although MinGW-w64 gcc can be made to work (I use it, for example) the instructions in the docs aren't sufficient; proper support needs extra work that isn't documented anywhere officially. If the goal here is easy installation, Visual C++ 2010 is definitely the best option. I posted some step-by-step instructions here. (I won't claim this is the only way, but to me it seemed like the easiest route.) – Oleksandr R. May 13 '12 at 6:50
@Oleksandr I agree, that's why I said it's a lot of trouble. I used MinGW-w64 for a while as well, but I don't remember if the sintructions in the docs were sufficient or not. I remember I set it up based on those though. – Szabolcs May 13 '12 at 6:59
This question might be retitled to indicate it is specific to Windows 64-bit, if that is the intent. Compiler setup is typically much simpler on Linux, MacOS, and even on 32-bit Windows where Cygwin and MinGW pretty much just work. – Joel Klein May 15 '12 at 19:02
up vote 15 down vote accepted

First, be sure to read the Specific Compilers section of the CCompilerDriver User Guide. This is the official place where the nuts and bolts of using external C compilers is discussed.

In that section, "Visual Studio Express and 64-Bit Targets" is where compilation on 64-bit Windows is discussed.

Some things to check when setting up:

  • Be sure to install .NET Framework 4 before Windows SDK 7.1. Without this, the Windows SDK installer may (if you don't have it) give a warning about this, and the Visual C++ component will be grayed out.

  • In the install wizard for the Windows SDK, be sure any components that say "Visual C++" are selected for installation.

If you're not sure if you have the .NET Framework 4, you can try running the Windows SDK 7.1 installer and look carefully for a warning dialog. If you don't get a dialog warning that .NET Framework is not detected, and the Visual C++ component is selectable for installation, then you may proceed with installing just the Windows SDK.

I can confirm that you don't need to install Visual Studio Express first, you can get away with installing only the .NET Framework 4 (if needed) and then the Windows SDK.

Edited to add: In answer to "If the compiler is installed correctly, should Mathematica automatically recognize it, or do I have to point Mathematica to a very specific folder to find it?", for Visual Studio it is automatically recognized through an environment variable or the registry. Of the compilers that are directly supported, as opposed to a "Generic" C compiler, they are all automatically detected in some form, depending on the specifics of the compiler.

share|improve this answer
This did it! Without uninstalling Windows SDK (again), I simply installed the .NET Framework 4 link, restarted my computer, and then now it works. CCompilers[] now gives {{"Name" -> "Visual Studio", "Compiler" -> CCompilerDriverVisualStudioCompilerVisualStudioCompiler, "CompilerInstallation" -> "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0", "CompilerName" -> Automatic}} Apparently, this link didn't install .Net Framework 4. – Paul May 15 '12 at 21:15
Yes, it's confusing that something called "Windows SDK for Windows 7 and the .NET Framework 4" does not install .NET Framework 4. – Joel Klein May 16 '12 at 13:54
Yes. I reinstalled the .Net Framework, it also works without reboot. So the .Net Framework installer in Intel C Compiler has some problems. After install the ICC, you must reinstall the .Net Framework in order to help Mathematica recognize the compiler. – DaoTRINH Feb 5 '14 at 16:01

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.