Error using:mtimesx_build.m

6 Ansichten (letzte 30 Tage)
zb li
zb li am 14 Jan. 2019
Kommentiert: Bruno Luong am 16 Jan. 2019
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 Kommentare
Walter Roberson
Walter Roberson am 14 Jan. 2019
mtimesx needs to setup C, not C++
Bruno Luong
Bruno Luong am 14 Jan. 2019
Bearbeitet: Bruno Luong am 14 Jan. 2019
I believe setup C++/C actually can be used with the same command
mex -setup C++

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Bruno Luong
Bruno Luong am 14 Jan. 2019
Bearbeitet: Bruno Luong am 14 Jan. 2019
If you run recent MATLAB you also must change the line #166 of mtimex_build.m to
mexopts = [prefdir '\mex_C_win64.xml'];
  8 Kommentare
zb li
zb li am 16 Jan. 2019
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 am 16 Jan. 2019
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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by