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.
CreateLibraryexample from the documentation, making sure to set the shell command function and shell output function toPrint, 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 withLoadLibraryfor the library to be able to load successfully ... – Szabolcs Oct 12 '15 at 15:39pathandlibrary_path, and of course$$CCompiler– matheorem Oct 12 '15 at 16:36