MATLAB Answers

Problem with MEX - perl error.

6 views (last 30 days)
Bartosz Reichel
Bartosz Reichel on 7 Oct 2016
Edited: Prasad Mendu on 17 Oct 2016
Hi,
I would like to build dll based on my C++ code. Thus I plan to use mex in matlab. I have Visual Studio 2010 and Matlab 2013. I stack at the beginning. First I would like to configure mex and I run "mex -setup" command as a first run I received:
>> mex -setup
Can't locate auto/DynaLoader/dl_findfile.al in @INC (@INC contains: C:/Program Files/MATLAB/R2013b/sys/perl/win32/site/lib C:/Program Files/MATLAB/R2013b/sys/perl/win32/lib .) at C:/Program Files/MATLAB/R2013b/sys/perl/win32/lib/DynaLoader.pm line 194
Compilation failed in require at C:\Program Files\MATLAB\R2013b\bin\mex.pl line 127.
BEGIN failed--compilation aborted at C:\Program Files\MATLAB\R2013b\bin\mex.pl line 135.
BEGIN failed--compilation aborted at C:\Program Files\MATLAB\R2013b\bin\mex.pl line 135.
Unable to complete successfully.
I add this file from other perl installation but still have error which look like this:
>> mex -setup
Can't locate loadable object for module Win32 in @INC (@INC contains: C:/Program Files/MATLAB/R2013b/sys/perl/win32/site/lib C:/Program Files/MATLAB/R2013b/sys/perl/win32/lib .) at C:\Program Files\MATLAB\R2013b\bin\mex.pl line 127
Compilation failed in require at C:\Program Files\MATLAB\R2013b\bin\mex.pl line 127.
BEGIN failed--compilation aborted at C:\Program Files\MATLAB\R2013b\bin\mex.pl line 135.
BEGIN failed--compilation aborted at C:\Program Files\MATLAB\R2013b\bin\mex.pl line 135.
Unable to complete successfully.
I never modify this folder, win32 exists and I think that I should not change anything and this should work ?
I will be grateful for any help Bartosz

Answers (1)

Prasad Mendu
Prasad Mendu on 17 Oct 2016
Edited: Prasad Mendu on 17 Oct 2016
Do you also have SDK 7.1 installed on your machine? If yes, this issue could be because of a bug described below.
There is a known bug with Microsoft Visual Studio 2010 SP1 (both Express and Professional versions) and Windows SDK 7.1. When the SDK is installed after the Visual Studio 2010 is updated to SP1, the installation removes the core compilers from the system. Microsoft has a bug report on the issue and has released a patch.
Bug details from Microsoft: http://support.microsoft.com/kb/2519277
In case you want to use the Microsoft SDK 7.1 along with .NET framework 4.0 as the compiler to mex your code, refer to the link below for installation instructions:
https://www.mathworks.com/matlabcentral/answers/101105-how-do-i-install-microsoft-windows-sdk-7-1
It will be helpful to look at the troubleshooting section of the link given above if you decide to use this option.

Products

Community Treasure Hunt

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

Start Hunting!