I'm trying to use Mathematica's Compile[]
function to speed up some of my computations:
Compile[<some_code>, CompilationTarget -> "C", RuntimeOptions -> "Speed"];
However, whenever I try to do so, I get the following error:
CCompilerDriver`CreateLibrary::nocomp: A C compiler cannot be found on your system. Please consult the documentation to learn how to set up suitable compilers.
When I execute the following code:
Needs["CCompilerDriver`"]
CCompilers[]
I get
{}
And when I execute
CCompilers[Full]
I get
{{"Name" -> "Intel Compiler",
"Compiler" -> CCompilerDriver`IntelCompiler`IntelCompiler,
"CompilerInstallation" -> None,
"CompilerName" -> Automatic}, {"Name" -> "Generic C Compiler",
"Compiler" -> CCompilerDriver`GenericCCompiler`GenericCCompiler,
"CompilerInstallation" -> None, "CompilerName" -> Automatic}}
I am using Mathematica 11 and Windows 11. What I've tried so far:
- Installed
gcc
on my computer and configured thePATH
correctly. When I typegcc
on the command line, I get the expected output. - Installed Visual Studio 2022 C++ development tools.
- Installed Visual Studio 2022 Build Tools for C/C++ development.
- Read the documentations (both the official one and the one linked below).
What more can I do?
$CCompiler = {"Compiler" -> CCompilerDriver
MinGWCompilerMinGWCompiler, "CompilerInstallation" -> "C:\\Program Files\\CodeBlocks\\MinGW\\bin"};
which give the location of the MinGW c-compiler bin file on my machine. $\endgroup$