mtimesx library compile error

hello
I am trying to use mtimesx on matlab 2016a, windows 10 64-bit, but I get the error " A C/C++ compiler has not been selected with mex -setup error" and understand I should change mexopts = [prefdir '\mexopts.bat']; in mtimesx_build.m to mexopts = [prefdir '\mex_C++_win64.xml']; but in path C:\Users\..\AppData\Roaming\MathWorks\MATLAB\R2016a this xml dosent exit, how could I complime this library?
Thank you

Answers (2)

TMW changed the way the mex function operates a couple of years ago. Unfortunately at that time I did not have access to recent MATLAB versions so I never got around to updating the automatic build code in my FEX submission. I still don't have access to the latest versions, but in the meantime maybe you can work with a stripped down version that is basically a manual compile with no checking. You may have to manually edit the paths etc to get it to work on your machine. Hopefully in the future I will be able to fix up the automated build process.
function mtimesx_build_new
mexargs{1} = 'mtimesx.c';
mexargs{2} = '-largeArrayDims';
mexargs{3} = '-DCOMPILER=UNKNOWN'; % Edit with your compiler or leave as is
% You may need to edit this section to get the directories set properly for
% your machine. The below is for Windows, and assumes lcc for 32-bit.
comp = computer;
mext = mexext;
lc = length(comp);
lm = length(mext);
cbits = comp(max(1:lc-1):lc);
mbits = mext(max(1:lm-1):lm);
if( isequal(cbits,'64') || isequal(mbits,'64') )
compdir = 'win64';
libdir = 'microsoft';
else
compdir = 'win32';
libdir = 'lcc';
end
lib_blas = [matlabroot '\extern\lib\' compdir '\' libdir '\libmwblas.lib'];
d = dir(lib_blas);
if( isempty(d) )
disp('... BLAS library file not found, so linking with the LAPACK library');
lib_blas = [matlabroot '\extern\lib\' compdir '\' libdir '\libmwlapack.lib'];
end
disp(['... Using BLAS library lib_blas = ''' lib_blas '''']);
mexargs{4} = lib_blas;
% The compile
mex(mexargs{:});
return
end

1 Comment

If your compiler is OpenMP compliant (which it looks like it is), you might also throw in this option:
mexargs{5} = 'COMPFLAGS="$COMPFLAGS /openmp"';

Sign in to comment.

First install a compiler, and then execute
mex -setup C++
at the command line. For Windows 10 and R2016a, you will need MingW, or Microsoft Visual C++ 2015 Professional, or Intel Parallel Studio XE 2016 for C/C++, or Intel Parallel Studio XE 2015 for C/C++

2 Comments

thank you for your answer, I use Microsoft Visual C++ 2015 Professional but it didn't work .is it incompatible with matlab 2016a?
My understanding is that product is compatible with R2016a on Windows 10.

Sign in to comment.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Asked:

on 19 Jun 2016

Commented:

on 20 Jun 2016

Community Treasure Hunt

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

Start Hunting!