如何将 MATLAB 的 mex 设置定向到Microsoft Windows SDK 进行C++编译?(设置位置时出错)
How to direct MATLAB's mex setup to the Microsoft Windows SDK for C++ compiling? (error in setting location)
我在Windows Vista
上,想用MATLAB
编译C++
函数。我在系统上只有lcc compiler
,当运行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/R2011a/win32.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:PROGRA~1MATLABR2011asyslcc
[0] None
Compiler:
由于lcc不适用于c++,所以我从这里(Windows站点)安装了Windows SDK 7.1。我运行Windows SDK 7.1 Command Prompt
来查看它被安装到的目录,并查看C:Program FilesMicrosoft SDKsWindowsv7.1
。然后我再次运行mex -setup
将编译器设置为Microsoft Visual C++ 2010
,通过告诉mex
不定位已安装的编译器,我选择Microsoft Visual C++ 2010
选项,然后MATLAB默认查看的路径是Visual Studio
;C:Program FilesMicrosoft Visual Studio 10.0
。我试图推翻它,但它不起作用。以下是所采取的具体操作:
>> 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/R2011a/win32.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++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[2] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[3] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker)
[4] Lcc-win32 C 2.4.1
[5] Microsoft Visual C++ 6.0
[6] Microsoft Visual C++ 2005 SP1
[7] Microsoft Visual C++ 2008 SP1
[8] Microsoft Visual C++ 2010
[9] Microsoft Visual C++ 2010 Express
[10] Open WATCOM C++
[0] None
Compiler: 8
Warning: The default location for Microsoft Visual C++ 2010 compiler is:
"C:Program FilesMicrosoft Visual Studio 10.0"
but either that directory does not exist or the configuration
is invalid.
Use C:Program FilesMicrosoft Visual Studio 10.0 anyway [y]/n? n
Please enter the location of your compiler: [C:Program FilesMicrosoft Visual Studio 10.0]
C:Program FilesMicrosoft SDKsWindowsv7.1
Please verify your choices:
Compiler: Microsoft Visual C++ 2010
Location: C:Program FilesMicrosoft Visual Studio 10.0
Are these correct [y]/n?
*****************************************************************************
Error: Microsoft Visual C++ 2010 requires the Microsoft Windows Software
Development Kit (SDK), but the SDK cannot be found. Examine your
Microsoft Visual C++ 2010 installation.
*****************************************************************************
??? Error using ==> mex at 208
Unable to complete successfully.
我不知道这个目录是否应该和C:Program FilesMicrosoft SDKsWindowsv7.1
不同,是否有办法识别这个目录。我也不知道我给目录的方式是否正确。我试着在目录名称周围使用单引号,唯一的变化是它停止问我visual studio的目录是否正确,我回答n,只有这是给定的。
Compiler: Microsoft Visual C++ 2010
Location: C:Program FilesMicrosoft Visual Studio 10.0
Are these correct [y]/n? n
mex: No compiler selected. No action taken.
我如何将编译器添加到MATLAB中才能在c++函数/文件上运行mex ?
如果您是在快速简便的方法之后(并且不使用64位matlab),我建议您下载Visual Studio 2010 c++ express的免费副本并使用它。这样mex -setup就会检测到它。
相关文章:
- 在编译时为运行时设置环境变量
- 如何设置叮当格式的注释编译指示,以免触及多行doxygen注释?
- 如何使用msbuild和设置C++17命令行编译Visual Studio项目?
- 如何使用CMAKE设置交叉编译配置的特定CMAKE_C_OUTPUT_EXTENSION?
- 在VS2017中,我们如何在项目成员之间共享编译设置
- 如何在cmake工具链文件中设置编译功能,以便已知的自定义编译器使用target_compile_features
- 我们可以在INI文件中使用 #ifdef 宏,或者我们如何限制INI文件中写入的设置的编译?
- 设置Qt Creator以链接和编译汇编代码
- CMake 使用设置编译依赖项
- 用于Raspberry Pi的交叉编译的设置QT
- 设置 VS 代码以编译C++程序
- 在编译时间检查模板参数类型是否设置或多键,并且容器的元素类型是算术的
- Codelite不使用全局编译设置或项目编译设置
- 设置具有非constexpr函数的constexpr变量(但可以在编译时间计算)
- 如何设置CMake与clang进行Windows嵌入式ARM的交叉编译
- 在编译时设置矢量的值
- 在编译时填充标准::设置
- 如果未设置编译符号,如何排除方法?如何传递可变数量的参数并在函数体中格式化它们
- 如何在cpp文件(C++)中设置编译标志
- 在Visual Studio 2008中设置编译时警告,类似"static_if"?