2
$\begingroup$

I am unable to set up the C compiler on my computer, thus can't not make the option CompilationTarget-"C" work in Compile. I am using windows 8 system.

At first, I install VS2013 express. CCompilers[Full] shows that mma has detected it.

{"Name" -> "Visual Studio", 
 "Compiler" -> 
  CCompilerDriver`VisualStudioCompiler`VisualStudioCompiler, 
 "CompilerInstallation" -> 
  "C:\\Program Files (x86)\\Microsoft Visual Studio 12.0", 
 "CompilerName" -> Automatic}

But compilation always gives errors like this

CCompilerDriver`CreateLibrary::cmperr: Compile error: LINK : fatal error LNK1104: ÎÞ[CenterDot]¨.b4ò¿ªÎļþ¡[Degree]LIBCMT.lib¡[PlusMinus] >>

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

After searching, I actually didn't find any LIBCMT.lib file.

Then, I took advice to try to install windows sdk. Unfortunately, the installation failed, don't know why!!!!

Finally, according to Specific compiler documentation page. I tried Mingw-64. Then installation is fine. But the mma seems just can't detect it. For CCompilers[Full] shows

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

So I run the following

$CCompiler = {"Compiler" -> 
    CCompilerDriver`GenericCCompiler`GenericCCompiler, 
   "CompilerInstallation" -> 
    "c:/Program \
Files/mingw-w64/x86_64-5.2.0-win32-seh-rt_v4-rev0/mingw64", 
   "CompilerName" -> "x86_64-w64-mingw32-gcc.exe"};

But except change the default compiler, "CompilerInstallation" still shows "none" and running compiled code gives errors

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

Need help. I really don't know how to do it right.

$\endgroup$
8
  • $\begingroup$ I'm voting to close this question as off-topic because it does not relate to the Mathematica programming language. $\endgroup$
    – Bob Hanlon
    Oct 12, 2015 at 15:18
  • $\begingroup$ @BobHanlon I modified my question title, maybe now it is much related to mathematica $\endgroup$
    – matheorem
    Oct 12, 2015 at 15:28
  • $\begingroup$ I retracted my vote and will leave it up to others. $\endgroup$
    – Bob Hanlon
    Oct 12, 2015 at 15:31
  • $\begingroup$ I would try this: First, I would make sure to install mingw in a directory with no spaces in its path. Then, I would try to CreateLibrary example from the documentation, making sure to set the shell command function and shell output function to Print, to have some idea about how Mathematica is calling the compiler and what errors the compiler might be reporting. Also, binaries created by some versions of this compiler need additional DLLs to run. Once compilation is successful, these may still need to be loaded with LoadLibrary for the library to be able to load successfully ... $\endgroup$
    – Szabolcs
    Oct 12, 2015 at 15:39
  • 4
    $\begingroup$ Also, search this site for more MinGW-64 posts which can provide hints. mathematica.stackexchange.com/q/55034/12 If you solved it, please write a self-answer. $\endgroup$
    – Szabolcs
    Oct 12, 2015 at 15:42

0

Browse other questions tagged or ask your own question.