I am running MMA 64 bit recently migrated to this Windows 10 64 bit machine from a Windows 7 64 bit machine.

On the old machine I had Visual Studio 2015 installed, and compilation was setup in in MMA 10 but continued to work fine in 11.

On the new PC I downloaded my MMA afresh and made sure to get the 2015 community edition of visual studio I had before (though possibly with some "updates") [NB I first tried visualcppbuildtools_full.exe, as recommended by @szabolcs somewhere, but that also produced the C1083 error so I thought I;d go back to what I thought I knew... So, we're several hours into this now.]



{{"Name" -> "Visual Studio", 
  "Compiler" -> 
  "CompilerInstallation" -> 
   "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0", 
  "CompilerName" -> Automatic}, {"Name" -> "Intel Compiler", 
  "Compiler" -> CCompilerDriver`IntelCompiler`IntelCompiler, 
  "CompilerInstallation" -> None, 
  "CompilerName" -> Automatic}, {"Name" -> "Generic C Compiler", 
  "Compiler" -> CCompilerDriver`GenericCCompiler`GenericCCompiler, 
  "CompilerInstallation" -> None, "CompilerName" -> Automatic}}

But on a simple compilation test

compListMul = Compile[{{l1, _Real, 1}, {l2, _Real, 1}}, l1 * l2 ,CompilationTarget -> "C", "RuntimeOptions" -> "Speed"]

I get

CreateLibrary::cmperr: Compile error: C:\Users\Julian\AppData\Roaming\Mathematica\ApplicationData\CCompilerDriver\BuildFolder\lotan-14584\Working-lotan-14584-14612-1\compiledFunction0.c(1): fatal error C1083: Cannot open include file: 'math.h': No such file or directory

Compile::nogen: A library could not be generated from the compiled function.

This seems very fundamentally broken so I'm hoping the fix is straightforward...

Question: what's wrong and how do I fix it?

Many, many thanks

  • $\begingroup$ I am not at all confident in this, but it is possible that some components of Visual Studio are missing. math.h should come with it, and it is such an essential part that I find it hard to believe that it is even possible not to install it. $\endgroup$
    – Szabolcs
    Feb 1, 2018 at 17:56
  • $\begingroup$ @Szabolcs Well, there is one in C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\km\crt but, whilst no expert, that location doesn't feel right... I think I may have to uninstall a lot and go back to square 1. Only things is, VS said it installed ok. $\endgroup$ Feb 1, 2018 at 18:06

1 Answer 1


On a different application, I ran into the same compilation problem. I was missing the Boost libraries which had somehow been removed in a new installation. Reinstalling them fixed the problem. Maybe check if they have been installed? Alternatively, try reinstalling the Microsoft 2017 build tools making sure the Cmake tools and compilers for C++ are included in installation options?



  • $\begingroup$ Boost is not needed for Mathematica's Compile, and neither is cmake. This problem is not related to either boost or cmake. The 2017 build tools are not compatible with OP's version of Mathematica. $\endgroup$
    – Szabolcs
    Feb 1, 2018 at 19:11
  • $\begingroup$ Fair enough. Not 100% sure then, but the only reasonable explanations are as you suggested which is that somehow VS 2015 is corrupted or that VC++ was forgotten to be installed on installing VS 2015 (if this is the case see solutions here: stackoverflow.com/questions/38290169/…). Math.h is too core to be missing otherwise if its not a problem with supplemental libraries. Presumably reinstalling/modifying the installation or installing the Visual C++ Build Tools 2015 should solve the problem, no? $\endgroup$
    – bkapz
    Feb 1, 2018 at 21:12
  • $\begingroup$ I spent some time last night trying to clean out old vs etc installations and will try from scratch again this weekend. $\endgroup$ Feb 2, 2018 at 14:07
  • $\begingroup$ I used @szabolcs suggestion of the C++ build tools only. Didn't work. Installation seemed ok, and the environment variable was there for VStools but I still had the C1083 fatal error. So I thought I'd try cygwin instead. Once that was installed, MMA compiled... using visual studio - it's the only compiler return by CCompilers[] (no sign of cygwin). MMA has been restarted but the system hasn't so I have no idea what's going on, but it works now so... $\endgroup$ Feb 3, 2018 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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