MSVC issue

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

MSVC issue

Postby abscissaordinate » Wed Jan 23, 2013 4:23 pm

I use MATLAB R2012a, Visual Studio Professional 2010, and the Dynare 4.3.2 on a Windows machine.

Here is the error I encountered when executing Dynare. (Note: I have no problem running this on a Mac nor in Ubuntu.)

Code: Select all
LINK : error LNK2001: unresolved external symbol Dynamic
C:\Users\[username_removed]\AppData\Local\Temp\mex_3EYSFq\templib.x : fatal error LNK1120: 1 unresolved externals
 
  C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Link of '[dynare_mod_file_removed]_static.mexw64' failed.


Any ideas what is causing this?

Thanks!
abscissaordinate
 
Posts: 15
Joined: Wed Nov 14, 2007 2:07 am

Re: MSVC issue

Postby jpfeifer » Mon Jan 28, 2013 6:05 pm

Hi, which Windows are you using? And what exactly did you do to get this error message? Lastly, could you please post the things Dynare says after startup, like:

Configuring Dynare ...
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: MSVC issue

Postby abscissaordinate » Mon Jan 28, 2013 6:16 pm

jpfeifer: I just ran Dynare without use_dll and it ran as expected.

In case there is a bug with use_dll, here is the information you asked for.

I use Windows 7 64-bit.

The command I issue Matlab is
Code: Select all
dynare [mod file name] msvc


Here is what Dynare says after start up:
Code: Select all
Configuring Dynare ...
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.
 
Starting Dynare (version 4.3.2).
Starting preprocessing of the model file ...
Found 23 equation(s).
Evaluating expressions...done
Computing static model derivatives:
 - order 1
Computing dynamic model derivatives:
 - order 1
 - order 2
 - order 3
Processing outputs ...done
Preprocessing completed.
Starting MATLAB/Octave computing.

LINK : error LNK2001: unresolved external symbol Dynamic
C:\Users\[username]\AppData\Local\Temp\mex_PKpfKq\templib.x : fatal error LNK1120: 1 unresolved externals
 
  C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Link of '[mod name]_static.mexw64' failed.


Thanks!
abscissaordinate
 
Posts: 15
Joined: Wed Nov 14, 2007 2:07 am

Re: MSVC issue

Postby jpfeifer » Mon Jan 28, 2013 10:30 pm

I can replicate the issue on my machine. We will look into it and keep you posted.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: MSVC issue

Postby SébastienVillemot » Thu Feb 07, 2013 11:49 am

This is a bug in Dynare, that will be fixed in the next release.

In the meantime, you can download a new preprocessor binary there: http://www.dynare.org/sebastien/4.3.2+msvc/dynare_m.exe

Replace your existing binary by that new one, and compilation with MSVC should now work.

Thanks for reporting this,
Sébastien Villemot
Economist at OFCE – Sciences Po
SébastienVillemot
 
Posts: 706
Joined: Fri Dec 07, 2007 2:29 pm
Location: Paris, France

Re: MSVC issue

Postby georgiana_alina » Sun Dec 18, 2016 1:33 pm

Hello to everyone!

I also have a similar error while trying to run a mod file with dynare 4.4.3, using Matlab R2012a (32 bit) and Windows 7 Ultimate.

I have downloaded Microsoft Visual C++ Professional SP1 as compiler for mex files (in order to be able to use the command use_dll), but when I write in Matlab the command >> mex –setup I obtain the following error:

C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: '–setup' not found.

Error using mex (line 206)
Unable to complete successfully.

Can you please indicate me in what subfolder of Matlab should I extract the new installation for Microsoft Visual C++ Professional SP1? As I have tried to use the unzip command: >> unzip(C:\Users\oana\Downloads\vcredist_x86(1),matlabroot) and the following error occurs: unzip(C:\Users\oana\Downloads\vcredist_x86(1),matlabroot)
|
Error: Unexpected MATLAB operator.

Most probably due to the inappropriate installation of compiler, when running the mod file using the command: dynare file_name msvc, the following error occurs:

unrecognized option -export:Dynamic

C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Link of 'mze_dynamic.mexw32' failed.

Error using mex (line 206)
Unable to complete successfully.
Error in mze (line 748)
eval('mex -O LINKFLAGS="$LINKFLAGS /export:Dynamic" mze_dynamic.c mze_dynamic_mex.c')
Error in dynare (line 180)
evalin('base',fname) ;



Many thanks in advance for your support!
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: MSVC issue

Postby jpfeifer » Sun Dec 18, 2016 8:47 pm

This is strange, because the
Code: Select all
mex -setup

is a Matlab command that is not related to Dynare. What does Matlab return when you type
Code: Select all
which mex


Also, you need to check which compiler is supported by your Matlab version: https://it.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/SystemRequirements-Release2012a_SupportedCompilers.pdf
These compilers must be installed properly, not just unzipped. And they do not belong into the Matlab directory.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: MSVC issue

Postby georgiana_alina » Tue Dec 20, 2016 7:21 pm

Hi and many thanks for your answer.

The answer is that when I write the code:>>which mex
the output is:
C:\Program Files\MATLAB\R2012a\toolbox\matlab\general\mex.m


Instead, when I write the code:>> mex -setup
the output is:

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/compil ... 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\R2012a\sys\lcc

[0] None

Compiler: 1

Please verify your choices:

Compiler: Lcc-win32 C 2.4.1
Location: C:\PROGRA~1\MATLAB\R2012a\sys\lcc

Are these correct [y]/n? y

Trying to update options file: C:\Users\oana\AppData\Roaming\MathWorks\MATLAB\R2012a\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2012a\bin\win32\mexopts\lccopts.bat

Done . . .

**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/help/techdoc/m ... nue-1.html
Building with the -largeArrayDims option enables the new API.
**************************************************************************
Thanks in advance for your support!
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: MSVC issue

Postby jpfeifer » Wed Dec 21, 2016 7:40 am

That all looks good. You have selected a compiler. What happens now when you try to run the mod-file?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: MSVC issue

Postby georgiana_alina » Wed Dec 21, 2016 7:06 pm

Hi again,

When running the mod file, the error message is described below.
Many thanks for your help.

>> dynare mze

Configuring Dynare ...
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Starting Dynare (version 4.4.3).
Starting preprocessing of the model file ...
Substitution of endo lags >= 2: added 4 auxiliary variables and equations.
Found 96 equation(s).
Evaluating expressions...done
Computing static model derivatives:
- order 1
Computing dynamic model derivatives:
- order 1
- order 2
Processing outputs ...done
Preprocessing completed.
Starting MATLAB/Octave computing.

Error using mze (line 748)
When using the USE_DLL option, you must give either 'cygwin' or 'msvc' option to the 'dynare' command
Error in dynare (line 180)
evalin('base',fname) ;
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: MSVC issue

Postby jpfeifer » Wed Dec 21, 2016 7:12 pm

You need to call it with
Code: Select all
dynare mzw msvc
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: MSVC issue

Postby georgiana_alina » Thu Dec 22, 2016 6:09 pm

Hi,
I have also tried this to add "msvc" at the end of dynare function, but the error is similar, as described below.
Excuse me for my perseverance, but I really don't know how to solve this.

Many thanks,

>> dynare mze msvc

Configuring Dynare ...
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Starting Dynare (version 4.4.3).
Starting preprocessing of the model file ...
Substitution of endo lags >= 2: added 4 auxiliary variables and equations.
Found 96 equation(s).
Evaluating expressions...done
Computing static model derivatives:
- order 1
Computing dynamic model derivatives:
- order 1
- order 2
Processing outputs ...done
Preprocessing completed.
Starting MATLAB/Octave computing.

unrecognized option -export:Dynamic

C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Link of 'mze_dynamic.mexw32' failed.

Error using mex (line 206)
Unable to complete successfully.
Error in mze (line 748)
eval('mex -O LINKFLAGS="$LINKFLAGS /export:Dynamic" mze_dynamic.c mze_dynamic_mex.c')
Error in dynare (line 180)
evalin('base',fname) ;
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: MSVC issue

Postby jpfeifer » Fri Dec 23, 2016 3:09 pm

This seems to be an incompatibility between the Matlab version, the compiler and the Dynare version. Have you tried passing
Code: Select all
cygwin

instead of
Code: Select all
msvc
?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 10 guests