Error using:mtimesx_build.m

조회 수: 7 (최근 30일)
zb li
zb li 2019년 1월 14일
댓글: Bruno Luong 2019년 1월 16일
Hi everyone
I am very interested in using mtimesx , but I am new to compiling. When I Run mtimex_build.m, I get the following error:
>>Error using: mtimesx_build (line 446)
Unable to compile mtimesx.c
Can anybody help me? Thank you and best wishes,
  댓글 수: 4
Walter Roberson
Walter Roberson 2019년 1월 14일
mtimesx needs to setup C, not C++
Bruno Luong
Bruno Luong 2019년 1월 14일
편집: Bruno Luong 2019년 1월 14일
I believe setup C++/C actually can be used with the same command
mex -setup C++

댓글을 달려면 로그인하십시오.

답변 (1개)

Bruno Luong
Bruno Luong 2019년 1월 14일
편집: Bruno Luong 2019년 1월 14일
If you run recent MATLAB you also must change the line #166 of mtimex_build.m to
mexopts = [prefdir '\mex_C_win64.xml'];
  댓글 수: 8
zb li
zb li 2019년 1월 16일
answer : change the line #421
>> mtimesx_build
... Build routine for mtimesx
... Checking for PC
... Finding path of mtimesx C source code files
... Found file mtimesx.c in D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c
... Found file mtimesx_RealTimesReal.c in D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx_RealTimesReal.c
... Opened the mexopts.bat file in C:\Users\Dell\AppData\Roaming\MathWorks\MATLAB\R2016a\mex_C_win64.xml
... Reading the mexopts.bat file to find the compiler and options used.
... GCC is the selected compiler
... Assuming that GCC will link with Microsoft libraries
... OpenMP compiler potentially detected
... Checking to see that the ' -fopenmp' compile option is present
... The ' -fopenmp' compile option is not present ... adding it
... Creating custom options file D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx_mexopts.bat with the ' -fopenmp' option added.
... Using BLAS library lib_blas = 'C:\Program Files\MATLAB\R2016a\extern\lib\win64\microsoft\libmwblas.lib'
... Now attempting to compile ...
mex('D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c','-largeArrayDims',lib_blas,'-DCOMPILER=GCC')
Building with 'MinGW64 Compiler (C)'.
D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c: In function 'mexFunction':
D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c:592:10: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
ans = mexGetVariablePtr("caller","OMP_SET_NUM_THREADS");
^
... Well, *that* didn't work ...
This may be because an OpenMP compile option was added that the
compiler did not like. Attempting to compile again, but this time
will not add the ' -fopenmp' option.
... OpenMP compiler potentially detected, but not checking for ' -fopenmp' compile option
... Using BLAS library lib_blas = 'C:\Program Files\MATLAB\R2016a\extern\lib\win64\microsoft\libmwblas.lib'
... Now attempting to compile ...
mex('D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c','-largeArrayDims',lib_blas,'-DCOMPILER=GCC')
Building with 'MinGW64 Compiler (C)'.
D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c: In function 'mexFunction':
D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx.c:592:10: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
ans = mexGetVariablePtr("caller","OMP_SET_NUM_THREADS");
^
... Well, *that* didn't work either!
The mex command failed. This may be because you have already run
mex -setup and selected a non-C compiler, such as Fortran. If this
is the case, then rerun mex -setup and select a C/C++ compiler.
Error using mtimesx_build (line 446)
Unable to compile mtimesx.c
Bruno Luong
Bruno Luong 2019년 1월 16일
K>> xname
xname =
D:\Google Driver\Matalb code\mtimesx_20110223\mtimesx_mexopts.bat
That's odd. Normally this file is no longer used by MTIMESX V 20110223
And I told you to change the line #166 so this file won't be read.
Not sure why it's still read.
Please rename mtimesx_mexopts.bat or delete to make sure it be inglored by mtimesx_build

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by