2011-11-10 42 views
0

我正嘗試在Matlab中使用Deploytool爲我的項目生成一個.exe文件來創建Windows獨立應用程序。 (如此處所述:http://www.mathworks.co.uk/products/demos/compiler/deploytool/index.html)。Matlab部署工具 - Windows獨立應用程序

問題是,當在Deploytool中添加我的文件,然後按Build按鈕它要求我使用mbuild -setup設置我的編譯器。當我這樣做的唯一選擇我得到的是:

Would you like mbuild to locate installed compilers [y]/n? n 


    Select a compiler: 
    [1] Microsoft Visual C++ 2005 SP1 
    [2] Microsoft Visual C++ 2008 Express 
    [3] Microsoft Visual C++ 2008 SP1 
    [0] None 

,當我選擇的任何我得到這些:

*The default location for Microsoft Visual C++ 2008 Express compilers is C:\Program Files (x86)\Microsoft Visual Studio 9.0, 
but that directory does not exist on this machine. 
Please enter the location of your compiler:* 

我也得到了以下錯誤,當我建:

*Could not find the compiler "cl" on the DOS path. 
Use mbuild -setup to configure your environment properly. 
C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Unable to locate compiler. 
Error: An error occurred while shelling out to mbuild (error code = 2). 
Unable to build executable.* 

你能幫我解決這個問題嗎?

在此先感謝。

+0

哪個編譯器,你已經安裝在你的機器上?如果讓「mbuild -setup」找到已安裝的編譯器,會發生什麼? – Edric

+0

沒有選項時,我讓它成立自己。我應該如何安裝編譯器?我需要讓他們專門爲MATLAB? – Reyhaneh

+1

你需要安裝一個編譯器,我相信在Visual Studio Express編譯器可以從微軟免費獲得。 – Edric

回答

1

您需要允許mbuild檢測已安裝的編譯器。 Matlab編譯器包含一個默認的C編譯器。在我的Windows XP系統,我得到:

>> mbuild -setup 

Welcome to mbuild -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 standalone MATLAB applications: 

Would you like mbuild 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 
[2] Microsoft Visual C++ 2010 in C:\Program Files\Microsoft Visual Studio 10.0 
[3] Microsoft Visual C++ 2005 SP1 in C:\Program Files\Microsoft Visual Studio 8 

[0] None 

Compiler: 

我安裝Visual Studio的兩個版本,但你可以看到默認的編譯器是在MATLAB安裝目錄。

確保你回答「是」,當腳本詢問查找已安裝的編譯器

0

我在我的電腦上安裝了Microsoft Visual Studio Ultimate中。當被問到mbuild安裝程序中編譯器的位置時,我將它重定向到C:\Program Files (x86)\Microsoft Visual Studio 10.0。這對我有效。

0
  • 前往以下地址{C:\ Program Files文件\ MATLAB \ R2008a \工具箱\編譯\部署\ WIN32}

    並安裝此下面的設置 - 「MCRInstaller.exe」(這個安裝文件是用於設置運行時編譯器)安裝完成後,您可以使用「部署工具」您的各自的文件,如* .Project。

享受...