首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将MATLAB的mex设置引导到进行C++编译?(设置位置错误)

如何将MATLAB的mex设置引导到进行C++编译?(设置位置错误)
EN

Stack Overflow用户
提问于 2013-04-08 15:10:47
回答 1查看 14.3K关注 0票数 1

我在Windows Vista上,希望使用MATLAB编译C++函数。我只有系统上的lcc compiler,在运行mex -setup时可以看到:

代码语言:javascript
复制
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~1\MATLAB\R2011a\sys\lcc 
[0] None 
Compiler:

由于lcc不适用于C++,所以我从这里(窗口站点)安装了WindowsSDK7.1。我运行Windows SDK 7.1 Command Prompt来查看它安装到的目录,并查看C:\Program Files\Microsoft SDKs\Windows\v7.1。然后我再次运行mex -setup将编译器设置为Microsoft Visual C++ 2010,通过告诉mex不要定位已安装的编译器,我选择了Microsoft Visual C++ 2010选项,然后MATLAB默认查看的路径是Visual StudioC:\Program Files\Microsoft Visual Studio 10.0。我试图推翻它,但在那里它不起作用。以下是所采取的具体行动:

代码语言:javascript
复制
>> 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 Files\Microsoft Visual Studio 10.0" 
     but either that directory does not exist or the configuration 
     is invalid. 
Use C:\Program Files\Microsoft Visual Studio 10.0 anyway [y]/n? n
Please enter the location of your compiler: [C:\Program Files\Microsoft Visual Studio 10.0] 
C:\Program Files\Microsoft SDKs\Windows\v7.1
Please verify your choices: 
Compiler: Microsoft Visual C++ 2010  
Location: C:\Program Files\Microsoft 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 Files\Microsoft SDKs\Windows\v7.1不同,也不知道是否有一种方法可以识别这个目录。我也不知道我给目录的方式是否正确。我试着在目录名周围使用单引号,唯一的变化是它停止问我到visual studio的目录是否正确,我回答了n,只给出了这个。

代码语言:javascript
复制
Compiler: Microsoft Visual C++ 2010  
Location: C:\Program Files\Microsoft Visual Studio 10.0 
Are these correct [y]/n? n
mex: No compiler selected. No action taken. 

如何将编译器添加到MATLAB中,以便能够在C++函数/文件上运行mex?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-08 15:21:48

如果你追求的是快速和简单的方法(不要使用64位matlab),我建议你下载一份免费的VisualStudio2010VisualStudio2010 C++表达式并使用它。这样,mex -setup就能检测到它。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15882696

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档