簡體   English   中英

如何將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++函數。 運行mex -setup時可以看到,我的系統上只有lcc compiler

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 ++,因此我從此處(Windows站點)安裝了Windows SDK 7.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 Studio的路徑; C:\\Program Files\\Microsoft 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 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 ,僅給出了此名稱。

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 ++ funcitons /文件上運行mex?

如果您追求快速簡便的方法(並且不使用64位Matlab),建議您下載Visual Studio 2010 C ++ Express的免費副本並使用它。 這樣,mex -setup將檢測到它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM