C++ 如何使用英特尔C++;Win7(x64)和xFF1F上的编译器(x86);

C++ 如何使用英特尔C++;Win7(x64)和xFF1F上的编译器(x86);,c++,compiler-construction,wolfram-mathematica,64-bit,mathematica-8,C++,Compiler Construction,Wolfram Mathematica,64 Bit,Mathematica 8,我的操作系统是64位windows 7。我安装了微软C++ 2008 Express版和英特尔C++编译器V1.1 1 x86版本。 现在我可以在Mathematica中成功编译x86C代码,例如 In[1]:= Needs["CCompilerDriver`"] In[2]:= greeter = CreateExecutable[StringJoin["#include <stdio.h>\n", "int main(){\n", " printf(\"Hell

我的操作系统是64位windows 7。我安装了微软C++ 2008 Express版和英特尔C++编译器V1.1 1 x86版本。 现在我可以在Mathematica中成功编译x86C代码,例如

    In[1]:= Needs["CCompilerDriver`"]
    In[2]:= greeter = CreateExecutable[StringJoin["#include <stdio.h>\n", "int main(){\n", "  printf(\"Hello world.\\n\");\n", "}\n"], "hiworld", 
     "Compiler" -> CCompilerDriver`IntelCompiler`IntelCompiler, 
     "CompilerInstallation" -> "C:\\Program Files (x86)\\Intel\\Compiler\\11.1\\072\\", 
     "CompilerName" -> Automatic, "TargetSystemID" -> "Windows"]

    Out[2]= "C:\\...\\AppData\\Roaming\\Mathematica\\\
       SystemFiles\\LibraryResources\\Windows-x86-64\\hiworld.exe"
我想我需要指定一个默认的
“TargetSystemID”->“Windows”
,因为我的平台是x64,但我不知道如何在Mathematica中设置这样的选项

我有没有遗漏任何一点

PS:我最近不想安装Microsoft Visual Studio。

在您的中,您指定了所需的编译器。在第二个例子中,您没有——因此,Mathematica可能不“知道”您安装的编译器

运行
requires[“CCompilerDriver`]”
然后运行
CCompilers[Full]
查看Mathematica知道哪些编译器。还可以查看全局
$CCompilerDirectory

如果未显示英特尔和/或Microsoft编译器,请按照的页面进行操作。 要使英特尔编译器正常工作,我认为以下几点就足够了:

$CCompiler = {
 "Compiler" -> CCompilerDriver`IntelCompiler`IntelCompiler,
 "CompilerInstallation"->"C:\\Program Files (x86)\\Intel\\Compiler\\11.1\\072\\"}
也就是说,如果我使用上述代码将编译器的目录更改为错误,那么我得到的第一个错误类型(在
Compile::nogen
之前)是
CreateLibrary::instl
,而不是您收到的
LibraryFunction::libload
消息。您的默认生成目录可能有问题:
$CCompilerDefaultDirectory

响应于PS,Windows的英特尔C++ V1.1编译器位于测试过的编译器列表中,因此不需要安装MS VisualStudio。另一方面,您可以通过MiniGW或CygWin尝试Windows(另请参阅)

在中,您指定了所需的编译器。在第二个例子中,您没有——因此,Mathematica可能不“知道”您安装的编译器

运行
requires[“CCompilerDriver`]”
然后运行
CCompilers[Full]
查看Mathematica知道哪些编译器。还可以查看全局
$CCompilerDirectory

如果未显示英特尔和/或Microsoft编译器,请按照的页面进行操作。 要使英特尔编译器正常工作,我认为以下几点就足够了:

$CCompiler = {
 "Compiler" -> CCompilerDriver`IntelCompiler`IntelCompiler,
 "CompilerInstallation"->"C:\\Program Files (x86)\\Intel\\Compiler\\11.1\\072\\"}
也就是说,如果我使用上述代码将编译器的目录更改为错误,那么我得到的第一个错误类型(在
Compile::nogen
之前)是
CreateLibrary::instl
,而不是您收到的
LibraryFunction::libload
消息。您的默认生成目录可能有问题:
$CCompilerDefaultDirectory

响应于PS,Windows的英特尔C++ V1.1编译器位于测试过的编译器列表中,因此不需要安装MS VisualStudio。另一方面,您可以通过MiniGW或CygWin尝试Windows(另请参阅)