如何在 64 位 Windows 上设置 Microsoft Visual Studio 2008 Express Edition 与 MATLAB 7.7 (R2008b) 一起使用?

3 ビュー (過去 30 日間)
我想在 64 位 Windows 上设置 Microsoft Visual Studio 2008 Express Edition 与 MATLAB 7.7 (R2008b) 一起使用。

採用された回答

MathWorks Support Team
MathWorks Support Team 2021 年 5 月 13 日
編集済み: MathWorks Support Team 2021 年 5 月 13 日
已在 MATLAB 7.7 (R2008b) 中增加了 Microsoft Visual Studio 2008 Express Edition 的支持,以创建 MEX 文件。在 64 位 Windows 上,使用 Visual Studio 2008 Express Edition 需要您按如下所述安装一些可选组件。请注意,在某些情况下,下面所述的配置步骤也适用于 MATLAB 7.8 (R2009a)、MATLAB 7.9 (R2009b) 以及 MATLAB 7.10 (R2010a)。
 
有关 64 位 Windows 操作系统 MATLAB 更高版本支持的编译器,请参阅页面:
当在 64 位 Windows 上运行 64 位 MATLAB 时,您必须使用 64 位编译器编译 MEX 文件、MATLAB Compiler 和 Builder 组件、Simulink S 函数、RTW 模型等等。完整列表可在下面找到:
 
Visual Studio 2008 Express 的默认安装只能编译 32 位二进制文件,且无法与 MATLAB 一起使用。
 
为了编译 64 位二进制文件,必须安装“x64 编译器和工具”以及 Microsoft Windows 软件开发工具包 (SDK)。默认情况下,MATLAB 不会安装 x64 编译器和工具。
 
没有这些程序包,Visual Studio 可将简单的 C/C++ 应用程序编译为 32 位二进制文件 ---“Hello World”类型程序可按预期方式编译和执行。但是,Visual Studio 无法编译 MATLAB 所需的 64 位二进制文件。
 
要在安装 Visual Studio 2008 Express Edition 以及所有必需组件,请执行以下操作:
 
1.安装 Microsoft Visual Studio 2008 Express Edition。Visual Studio 2008 Express 主安装程序可从下面找到(C++ 安装程序名称是 vcsetup.exe):
 
此程序包可使用默认选项安装。
2.安装 Microsoft Windows SDK。Microsoft Windows SDK 可以通过搜索 Microsoft 下载站点或者直接转到以下网站获得:
 
下载 Windows Server 2008 和 .NET 3.5 SDK。请勿安装测试版或“候选发布”(RC) 版本。同样请勿安装“Microsoft Windows SDK for Windows 7 和 .NET Framework 4”(版本 7.1);如果您要使用 7.x 版本,请选择“Microsoft Windows SDK for Windows 7 和 .NET Framework 3.5 SP1”。
 
2.1.在安装 SDK 时,您必须选择“x64 编译器和工具”。例如,在上面的 SDK 安装程序中:
在“安装选项”屏幕上,选择“开发人员工具”->“Visual C++ 编译器”。
 
此项有描述“安装 Visual C++ 9.0 编译器。这些编译器针对您 x86、x64、IA64 处理器体系结构。”
 
3.要验证您是否包含所有已安装组件,请检查 Microsoft SDK 是否包含 C/C++ 编译器“cl.exe”的“amd64”版本。此程序通常安装在
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\cl.exe"
4.此时,您应该能够继续并像往常一样编译代码。
 
例如,要选择编译器并编译 YPRIME.C 示例 MEX 文件,
mex -setup      % 选择 Visual Studio 2008 Express Edition
copyfile(fullfile(matlabroot,'extern','examples','mex','yprime.c'))
mex -v yprime.c
yprime(1,1:4)
最后一行应该执行 MEX 文件,并计算以下输出:
ans =
 2.0000 8.9685 4.0000 -1.0947
如果您无法选择您的编译器、编译 MEX 文件或执行 MEX 文件,请查阅下面的“疑难解答”部分。
 
5.疑难解答
如果“x64 编译器和工具”安装不正确,则 MATLAB 可能会显示以下消息之一:
*****************************************************************************
  Error: Could not find the 64-bit compiler.  This may indicate that the         "X64 Compilers and Tools" or the Microsoft Windows Software         Development Kit (SDK) is not installed.  To build 64-bit MEX-files         Microsoft Visual C++ 2008 Express Edition requires that these two         packages are installed properly.
*****************************************************************************
*****************************************************************************
ERROR:   Error: Could not find the Microsoft Windows Software Development Kit (SDK).         This may indicate that the Microsoft Windows SDK or the         "X64 Compilers and Tools" is not installed.  To build 64-bit         MEX-files Microsoft Visual C++ 2008 Express Edition requires that         these two packages are installed properly.
*****************************************************************************
如果您看到这些消息,则您可能未正确安装 SDK 或 x64 编译器和工具,或者 MATLAB 可能无法在您的系统中定位它们。验证您是否已按照上面所述安装这些程序包。如需更多帮助,请与 MathWorks 技术支持联系。
 
有关哪些 MathWorks 产品支持您的 Visual Studio 2008 Express Edition 版本的信息,请参阅支持的编译器列表:
 

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange安装和许可简介 についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!