Size: 1603
Comment:
|
Size: 3004
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
This page briefly documents how to configure MATLAB for Windows when a MEX compilation environment is required. Under Linux and MacOS, this configuration step is not necessary, because these operating systems already come with a working compilation environment (using g++). | This page briefly documents how to configure MATLAB for Windows when a MEX compilation environment is required. Under Linux and MacOS, this configuration step is not necessary, because these operating systems already come with a working compilation environment (using gcc). |
Line 3: | Line 3: |
With Dynare, you need a working MEX compilation environment in two cases: * you need to recompile Dynare MEX files, without using Dynare build system * you want to use the {{{USE_DLL}}} option of {{{model}}}, or the {{{k_order_solver}}} option of {{{stoch_simul}}} |
Two compilers are currently supported: GNU C compiler (gcc) from Cygwin, and Microsoft Visual C++ (MSVC). |
Line 7: | Line 5: |
We describe here the installation of two compilers: GNU C++ compiler (g++), and Microsoft Visual C++ (MSVC). | With Dynare, you need a working MEX compilation environment if you want to use the {{{USE_DLL}}} option of {{{model}}}. In that case, you need to tell Dynare which compiler you are using: * if you are using Cygwin, type at the MATLAB prompt: {{{ dynare modfilename cygwin }}} * if you are using Microsoft Visual C++: {{{ dynare modfilename msvc }}} |
Line 9: | Line 15: |
Note that for {{{USE_DLL}}} and {{{k_order_solver}}}, the only supported compiler is g++ | = Configuring MATLAB with GNU C compiler (gcc) from Cygwin = |
Line 11: | Line 17: |
= Configuring MATLAB with GNU C++ compiler (g++) = * Install a Cygwin environment (see http://www.cygwin.com). You need at least the following packages: gcc, gcc-g++, gcc-mingw, gcc-mingw-g++ * Download [[attachment:mexopts.bat]], and put it in {{{c:\Documents and Settings\<User name>\Application Data\MathWorks\MATLAB\<release number>\}}} |
* Install a Cygwin environment (see http://www.cygwin.com). If your MATLAB is 32-bit, you need the "mingw64-i686-gcc" package. If your MATLAB is 64-bit, you need the "mingw64-x86_64-gcc" package. * The configuration file is called [[https://github.com/DynareTeam/dynare/raw/master/windows/mexopts-win32.bat|mexopts-win32.bat]] for MATLAB 32-bit, and [[https://github.com/DynareTeam/dynare/raw/master/windows/mexopts-win64.bat|mexopts-win64.bat]] for MATLAB 64-bit (these files are also distributed in recent packages of Dynare) * Rename the configuration file to {{{mexopts.bat}}}, and copy it to the right directory, which will be (depending on your version of Windows): * {{{c:\Users\<User name>\AppData\Roaming\MathWorks\MATLAB\<release number>\}}} (Windows 8) * {{{c:\Users\<User name>\Application Data\MathWorks\MATLAB\<release number>\}}} (Windows Vista/7) * {{{c:\Documents and Settings\<User name>\Application Data\MathWorks\MATLAB\<release number>\}}} (Windows XP) * Note that if you installed Cygwin in a non-standard directory (i.e. elsewhere than {{{C:\CYGWIN}}}), you need to edit the {{{mexopts.bat}}} and change the {{{set PATH=...}}} line accordingly. |
Line 20: | Line 29: |
* Install Visual C++ 2008 Express Edition, downloadable at http://www.microsoft.com/Express/VC/ | * Install Microsoft Windows SDK from [[https://www.microsoft.com/en-US/Download/details.aspx?id=8279|Microsoft Website]] |
Line 22: | Line 31: |
* For users of MATLAB 64-bit, please follow [[http://www.mathworks.fr/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L|these instructions]] for finishing the installation | = Configuring MATLAB releases before R2010a with Microsoft Visual C++ (MSVC) = Earlier versions of Matlab before R2010a do not support Visual Studio 2010: * For Matlab 2010a there is a patch available at http://www.mathworks.de/support/solutions/en/data/1-D5W493/?solution=1-D5W493. * For versions before 2010a, use Visual C++ 2008 Express Edition, downloadable at http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express. * For users of MATLAB 64-bit releases before R2010a, please follow [[http://www.mathworks.fr/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L|these instructions]] for finishing the installation. |
This page briefly documents how to configure MATLAB for Windows when a MEX compilation environment is required. Under Linux and MacOS, this configuration step is not necessary, because these operating systems already come with a working compilation environment (using gcc).
Two compilers are currently supported: GNU C compiler (gcc) from Cygwin, and Microsoft Visual C++ (MSVC).
With Dynare, you need a working MEX compilation environment if you want to use the USE_DLL option of model. In that case, you need to tell Dynare which compiler you are using:
- if you are using Cygwin, type at the MATLAB prompt:
dynare modfilename cygwin
- if you are using Microsoft Visual C++:
dynare modfilename msvc
Configuring MATLAB with GNU C compiler (gcc) from Cygwin
Install a Cygwin environment (see http://www.cygwin.com). If your MATLAB is 32-bit, you need the "mingw64-i686-gcc" package. If your MATLAB is 64-bit, you need the "mingw64-x86_64-gcc" package.
The configuration file is called mexopts-win32.bat for MATLAB 32-bit, and mexopts-win64.bat for MATLAB 64-bit (these files are also distributed in recent packages of Dynare)
Rename the configuration file to mexopts.bat, and copy it to the right directory, which will be (depending on your version of Windows):
c:\Users\<User name>\AppData\Roaming\MathWorks\MATLAB\<release number>\ (Windows 8)
c:\Users\<User name>\Application Data\MathWorks\MATLAB\<release number>\ (Windows Vista/7)
c:\Documents and Settings\<User name>\Application Data\MathWorks\MATLAB\<release number>\ (Windows XP)
Note that if you installed Cygwin in a non-standard directory (i.e. elsewhere than C:\CYGWIN), you need to edit the mexopts.bat and change the set PATH=... line accordingly.
Configuring MATLAB with Microsoft Visual C++ (MSVC)
The following should work with recent versions of MATLAB:
Install Microsoft Windows SDK from Microsoft Website
At MATLAB prompt, type mex -setup; it should autodetect MSVC, and let you select it
Configuring MATLAB releases before R2010a with Microsoft Visual C++ (MSVC)
Earlier versions of Matlab before R2010a do not support Visual Studio 2010:
For Matlab 2010a there is a patch available at http://www.mathworks.de/support/solutions/en/data/1-D5W493/?solution=1-D5W493.
For versions before 2010a, use Visual C++ 2008 Express Edition, downloadable at http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express.
For users of MATLAB 64-bit releases before R2010a, please follow these instructions for finishing the installation.