我试过了

    Needs["CCompilerDriver`IntelCompiler`"]

    greeter = CreateExecutable[StringJoin["#include <stdio.h>\n", "int main(){\n", "  printf(\"Hello world.\\n\");\n", "}\n"], "hiworld", "Compiler" -> IntelCompiler, "CompilerInstallation" -> "C:\\Program Files (x86)\\Intel\\Composer XE 2011 SP1\\bin\\ia32", "CompilerName" -> "icl.exe"]

但是得到一个错误:
    CreateExecutable::instl: The compiler installation directive "CompilerInstallation" -> C:\Program Files (x86)\Intel\Composer XE 2011 SP1\bin\ia32 does not indicate a usable installation of Intel Compiler. >>

编辑:
    In[776]:= CCompilers[Full]

    Out[776]= {{"Name" -> "Intel Compiler", "Compiler" -> IntelCompiler, "CompilerInstallation" -> None, "CompilerName" -> Automatic}, {"Name" -> "Generic C Compiler",  "Compiler" -> CompilerDriver`GenericCCompiler`GenericCCompiler,   "CompilerInstallation" -> None, "CompilerName" -> Automatic}}

    In[777]:= CCompilers[]
    Out[777]= {}

即使在指定编译器位置后,MMA仍未找到编译器。

我想念这里吗?

http://reference.wolfram.com/mathematica/CCompilerDriver/tutorial/SpecificCompilers.html#394172820

最佳答案

从...开始

  Needs["CCompilerDriver`IntelCompiler`"]

检查是否已安装IntelCompiler:
   CCompilers[Full]

就我而言,我得到这样的东西:
 {{"Name" -> "Visual Studio",
   "Compiler" -> CCompilerDriver`VisualStudioCompiler`VisualStudioCompiler,
   "CompilerInstallation" -> "C:\\Program Files\\Microsoft Visual Studio 10.0",
   "CompilerName" -> Automatic}, {...other compilers...},
   {"Name" -> "Intel Compiler", "Compiler" -> IntelCompiler,
    "CompilerInstallation" -> None, "CompilerName" -> Automatic}}

并评估您的输入greeter=... 错误消息就像您的情况一样。

而是从CCompilers[Full]的输出中复制正确安装
In[1]:= Needs["CCompilerDriver`VisualStudioCompiler`"]
In[2]:= greeter =  CreateExecutable[ StringJoin["#include <stdio.h>\n",
       "int main(){\n","  printf(\"Hello world.\\n\");\n", "}\n"], "hiworld",
        "Compiler" -> VisualStudioCompiler, "CompilerInstallation" ->
        "C:\\Program Files\\Microsoft Visual Studio 10.0", "CompilerName" -> "Automatic"]

Out[2]= "C:\\Users\\spindoctor\\AppData\\Roaming\\Mathematica\\\
             SystemFiles\\LibraryResources\\Windows\\hiworld.exe"

我得到了那个可执行文件。

关于c++ - 如何为Windows的Mathematica设置Intel C++ Composer XE?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8905293/

10-17 00:18