Problem Starting MEX file

4 views (last 30 days)
Chris
Chris on 13 Mar 2012
Commented: Walter Roberson on 1 Dec 2016
Hello,
I'm trying to learn about MEX files for a project where I will have to interface between a fortran code and matlab code.I wanted to start out with the examples for mathworks but can't get past the mex -setup. Please see the following:
>> 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/R2011b/win64.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++ 12.0 (with Microsoft Visual C++ 2008 SP1 linker)
[2] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker)
[3] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[4] Intel Visual Fortran 12 (with Microsoft Software Development Kit (SDK) linker)
[5] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 SP1 linker)
[6] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 Shell linker)
[7] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker)
[8] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[9] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker)
[10] Microsoft Software Development Kit (SDK) 7.1
[11] Microsoft Visual C++ 2005 SP1
[12] Microsoft Visual C++ 2008 SP1
[13] Microsoft Visual C++ 2010
[14] Microsoft Visual C++ 2010 Express
[0] None
Compiler: 9
Warning: The default location for Intel Visual Fortran compiler is:
"C:\Program Files (x86)\Intel\Compiler\11.1\054\"
but either that directory does not exist or the configuration
is invalid.
Use C:\Program Files (x86)\Intel\Compiler\11.1\054\ anyway [y]/n? n
Please enter the location of your compiler: [C:\Program Files (x86)\Intel\Compiler\11.1\054\] [C:\Program Files (x86)\Intel\Compiler\11.1\038\]
Please verify your choices:
Compiler: Intel Visual Fortran 11.1
Location: [C:\Program Files (x86)\Intel\Compiler\11.1\038\]
Are these correct [y]/n? y
***************************************************************************
Warning: Support for Intel Visual Fortran 11.1 will be discontinued in a
future release, at which time new versions will be supported.
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/R2011b/win64.html
***************************************************************************
Error: Microsoft Visual Studio 2008 SP1 Professional Edition was
not found by mex -setup.
The Microsoft Visual Studio 2008 SP1 Professional Edition
linker is required to build Intel Fortran MEX-files. Please
make sure that Microsoft Visual Studio 2008 SP1 Professional
Edition is installed properly.
Error using mex (line 206)
Unable to complete successfully.
I have intel fortran 11.1 compiler and mvs 2008shell. Any help so I can successfully link to the write compiler?
Chris

Accepted Answer

Ken Atwell
Ken Atwell on 20 Mar 2012
MEX is not able to find the 64-bit Visual C++ 2008 tools. I would recommend:
  1. First confirm that 64-bit Visual Studio 2008 and/or SDK 6.1 tools are installed. This version of Visual Studio may not have installed the 64-bit tools.
  2. Ensure that you can compile a simple 64-bit C program from the Visual Studio IDE and command line (the later using VCVARSALL -- you should have a Start Menu item for this)
  3. Only then try to bring the Intel compiler into the mix
If this sounds too painful, installing .NET 4.0 and then the (free) Microsoft Windows SDK 7.1 should give you the 64-bit tools you need.
  3 Comments
Chris
Chris on 29 Mar 2012
Hi Ken,
Yes I see this. Mathlab is now reading the 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/R2011b/win64.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Intel Visual Fortran 12 (with Microsoft Software Development Kit (SDK) linker) in C:\Program Files (x86)\Intel\ComposerXE-2011\
[2] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker) in C:\Program Files (x86)\Intel\ComposerXE-2011
[3] Microsoft Software Development Kit (SDK) 7.1 in c:\Program Files (x86)\Microsoft Visual Studio 10.0
[4] Microsoft Visual C++ 2010 in c:\Program Files (x86)\Microsoft Visual Studio 10.0
[0] None
Compiler: 1
Please verify your choices:
Compiler: Intel Visual Fortran 12
Location: C:\Program Files (x86)\Intel\ComposerXE-2011\
Are these correct [y]/n? y
Trying to update options file: C:\Users\Student\AppData\Roaming\MathWorks\MATLAB\R2011b\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2011b\bin\win64\mexopts\intelf12mssdk71opts.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/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9
Building with the -largeArrayDims option enables the new API.
**************************************************************************
Thanks for your help.

Sign in to comment.

More Answers (5)

Jan
Jan on 13 Mar 2012
Try answering "y", when the setup is asking "Would you like mex to locate installed compilers". What does appear?
  4 Comments
Jan
Jan on 27 Mar 2012
You believe? Which info shows the above message?

Sign in to comment.


hojjat
hojjat on 26 May 2013
hello
this is error in building mex-file in my pc please help me!
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/R2013a/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\R2013a\sys\lcc [2] Microsoft Software Development Kit (SDK) 7.1 in C:\Program Files\Microsoft Visual Studio 10.0 [3] Microsoft Visual C++ 2010 in C:\Program Files\Microsoft Visual Studio 10.0
[0] None
Compiler: 3
Please verify your choices:
Compiler: Microsoft Visual C++ 2010 Location: C:\Program Files\Microsoft Visual Studio 10.0
Are these correct [y]/n? y
************************************************************************* Warning: MEX-files generated using Microsoft Visual C++ 2010 require that Microsoft Visual Studio 2010 run-time libraries be available on the computer they are run on. If you plan to redistribute your MEX-files to other MATLAB users, be sure that they have the run-time libraries. *************************************************************************
Trying to update options file: C:\Users\eng\AppData\Roaming\MathWorks\MATLAB\R2013a\mexopts.bat From template: C:\PROGRA~1\MATLAB\R2013a\bin\win32\mexopts\msvc100opts.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/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html Building with the -largeArrayDims option enables the new API. ************************************************************************
>>
  1 Comment
Jan
Jan on 26 May 2013
@hojjat: 1. There are no error messages, but these are standard warning. Read them, add the required MSVC2010 redistributables when you share the compiled functions with others, use -largeArrayDims to apply 64 bit addressing. Then forget these messages.
2. Do not append a new question to an existing thread. Such thread-highjacking confuses the readers, because it will not be clear, to which question answer belong to. In addition you cannot accept an answer in a foreign thread.
3. As consequence from 1. and 2. I suggest to delete this "answer", because it is none and the question can be answered by "that's ok".

Sign in to comment.


Karuna Mudliyar
Karuna Mudliyar on 8 Oct 2013
I too faced similar problem
Finally I just uninstalled all the C++2010, C++2008 and C++2005. Then Installed the 7.1 SDK , by unchecking its c++ compiler and the visual studio while installing.
Then i could still see the C++2010 (64 and 86 one), in my control panel installed program list.
I gone ahead with installing the patch.
Then the problem got solved..
Note: While u start ur matlab.. the required c++2005 and c++2008 will get installed automatically.. so no need to worry if u get a command window.
  2 Comments
Walter Roberson
Walter Roberson on 1 Dec 2016
Which compiler did you install?

Sign in to comment.


nyanphyo aung
nyanphyo aung on 9 May 2015
I have already the same problem. Windows vista,Matlab 2009b, visual studio 2005
************************************************************************
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/support/solutions/data/1-5C27B9.html?solution=1-5C27B9
Building with the -largeArrayDims option enables the new API.
************************************************************************

farooq basha
farooq basha on 1 Dec 2016
hi my name is farooq
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/R2013a/win64.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? y
No supported SDK or compiler was found on this computer. For a list of supported compilers, see http://www.mathworks.com/support/compilers/R2013a/win64.html
Error using mex (line 206) Unable to complete successfully.
>> i have got this type of error plz somebody help me

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!