2013-12-17 56 views
-1

我對此很陌生,只是想問一下。我如何設置MATLAB來使用C++編譯器。看來,因爲我運行Windows 8.1的預發佈,我無法運行Visual Studio 2013年。所以,我在想一些C++的編譯器,當我運行`MEX -setup,我可以用」使用C++編譯器設置MATLAB

更新

我用Microsoft Windows SDK for Windows 7 and .NET Framework 4,並選擇它作爲編譯器,它工作。

謝謝。

+0

做什麼?構建MEX文件,獨立庫或可執行文件,是許多Builder目標之一? – chappjc

回答

1
mex -setup 

全部記錄在這裏:http://www.mathworks.co.uk/help/matlab/ref/mex.html

爲R2013b支持和兼容的編譯器的列表在這裏:http://www.mathworks.co.uk/support/compilers/R2013b/index.html

老版本從這個網頁鏈接。

+0

在這裏做一個假設...'mbuild -setup'呢? OP沒有說他想編譯的內容。 – chappjc

+0

@chappjc真的。然而,'mex -setup'往往是設置編譯器的第一件事,它將解決80%的用戶需求。其他類型的編譯器設置爲'mbuild -setup',正如你指出的那樣,編譯器用於MATLAB和Simulink編碼器等等。 – am304

+0

不要誤解我的意思,我同意這個問題可能是關於MEX文件的編譯,而你的答案對於良好的聯繫非常有幫助。如果問題得到澄清,我很快就會讚揚它。 – chappjc

1

首先你有一個C++編譯器安裝在你的電腦上?如果這應該工作..

>>mex -setup 

Please choose your compiler for building external interface (MEX) files: 
Would you like mex to locate installed compilers [y]/n? n 
Select a compiler: 
[1] Intel C++ 9.1 (with Microsoft Visual C++ 2005 linker) 
[2] Intel Visual Fortran 10.1 (with Microsoft Visual C++ 2005 linker) 
[3] Intel Visual Fortran 9.1 (with Microsoft Visual C++ 2005 linker) 
[4] Microsoft Platform SDK 14.0 
[5] Microsoft Visual C++ 2005 
[6] Microsoft Visual C++ 2008 
Compiler: 5 

The default location for Microsoft Visual C++ 2005 compilers is 
C:\Program Files (x86)\Microsoft Visual Studio 8, 
1 
but that directory does not exist on this machine. 
Use C:\Program Files (x86)\Microsoft Visual Studio 8 anyway [y]/n? n 
Please enter the location of your compiler: 
[C:\Program Files (x86)\Microsoft Visual Studio 8] 
E:\Program Files (x86)\Microsoft Visual Studio 8 
Please verify your choices: 
Compiler: Microsoft Visual C++ 2005 
Location: E:\Program Files (x86)\Microsoft Visual Studio 8 
Are these correct [y]/n? y 
Trying to update options file: 
C:\Users\fullfanta\AppData\Roaming\MathWorks\MATLAB\R2008a\mexopts.bat 
From template: E:\PROGRA~1\MATLAB\R2008a\bin\win64\mexopts\msvc80opts.bat 
Done . . .