1

私は試した

    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

4

1 に答える 1

2

で始まります

  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"

その実行可能ファイルを取得します。

于 2012-01-18T14:29:17.760 に答える