1

我試圖如何爲Mathematica for Windows設置Intel C++ Composer XE?

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

+0

答案是:安裝C編譯器! – Artes 2012-01-18 18:19:29

+0

@我做過的藝術。我安裝了英特爾C++ Composer XE 2011 SP1,這是舊版英特爾C++編譯器的升級。但看起來MMA不承認它。 – 2012-01-19 02:27:24

回答

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" 

的輸出複製我得到的可執行文件。

相關問題