I installed Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 Then, I installed Mathematica 10 trial version.

I did:


$CCompiler = {"Compiler" -> GenericCCompiler, 
"CompilerInstallation" -> 
"C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\bin", 
"CompilerName" -> "cl.exe"};

Compile[{{x}}, x^2 + Sin[x^2], CompilationTarget -> "C"];

I got:

CreateLibrary::badcomp: Compiler specification "Compiler" -> GenericCCompiler does not specify a compiler driver listed by CCompilers[Full]. >>

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

How can I set up c compiler which I installed for Mathematica?

  • $\begingroup$ Do not set $CCompiler. If the Microsoft compiler is installed correctly, Mathematica will auto-detect it. Re-start Mathematica (including the front end) after installing the compiler. $\endgroup$
    – Szabolcs
    Aug 17, 2014 at 23:26
  • $\begingroup$ It did not work. No matter if I use $CCompiler or not use it, I cannot compile for c compiler. I even restarted Windows but no success. $\endgroup$
    – MOON
    Aug 18, 2014 at 0:24
  • $\begingroup$ Then the compiler is likely not properly installed. There should be an environment variable names VS90COMNTOOLS or similar. Can you check if it exists? Evaluate GetEnvironment[] and look for it. $\endgroup$
    – Szabolcs
    Aug 18, 2014 at 1:08
  • $\begingroup$ Related: (5487), (41682). $\endgroup$
    – Silvia
    Aug 18, 2014 at 9:55
  • $\begingroup$ @Silvia One of the topics is abput visual studio 2013. I have installed 2008 edition. The other says install .Net before SDK but when Í install SDK it installs .Net too. $\endgroup$
    – MOON
    Aug 18, 2014 at 11:28


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.