我正在尝试使用R2011b中的MATLAB功能块。当我尝试运行我的程序时,这是我得到的错误:
无法找到Stateflow和MATLAB功能块所需的C编译器。
使用'mex -setup'选择支持的C编译器。
当我尝试mex -setup
时,我得到以下输出:
>> mex -setup
Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2011b/win64.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? n
Select a compiler:
[1] Intel C++ 12.0 (with Microsoft Visual C++ 2008 SP1 linker)
[2] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker)
[3] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[4] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 SP1 linker)
[5] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 Shell linker)
[6] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker)
[7] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[8] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker)
[9] Microsoft Software Development Kit (SDK) 7.1
[10] Microsoft Visual C++ 2005 SP1
[11] Microsoft Visual C++ 2008 SP1
[12] Microsoft Visual C++ 2010
[13] Microsoft Visual C++ 2010 Express
[0] None
Compiler: 1
Warning: The default location for Intel C++ compiler is:
"C:\Program Files (x86)\Intel\ComposerXE-2011"
but either that directory does not exist or the configuration
is invalid.
Use C:\Program Files (x86)\Intel\ComposerXE-2011 anyway [y]/n? y
Please verify your choices:
Compiler: Intel C++ 12.0
Location: C:\Program Files (x86)\Intel\ComposerXE-2011
Are these correct [y]/n? y
Error: Microsoft Visual Studio 2008 SP1 Professional Edition was not found
by mex -setup.
The Microsoft Visual Studio 2008 SP1 Professional Edition linker is
required to build Intel C++ MEX-files. Please make sure that
Microsoft Visual Studio 2008 SP1 Professional Edition is installed
properly.
Error using mex (line 206)
Unable to complete successfully.
无论我选择哪种编译器,我都会遇到同样的错误。我需要选择哪个编译器,还是有其他问题?
答案 0 :(得分:1)
通过检查您的评论,我们首先要求您选择是选项,以查看您的计算机是否安装了任何有效的编译器。您选择了它,它找不到任何有效的编译器。因此,您的计算机上没有安装任何编译器。
通常,如果要在Windows中编译MEX文件,则需要Microsoft Visual Studio编译器才能执行此操作。为了实现这一目标,我有四种解决方案,具体取决于您可以使用的内容: