Error using mex (line 206), need help

조회 수: 9 (최근 30일)
MichaelK Kim
MichaelK Kim 2012년 10월 20일
댓글: Walter Roberson 2020년 8월 27일
I've tried to utilize someone's coding on matlab with mex file. but it doesnt work at all. how can i fix this problem?
First of all, i've tried to setup the compiler on matlab using "mex -setup" command.
and then finished the setup.
but if i run the code, error came up!
here is my command and error. it looks simple issue, but i dont have a time to figure out solution by myself ;(
>> 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/R2012a/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\R2012a\sys\lcc
[2] Microsoft Visual C++ 2005 SP1 in C:\Program Files\Microsoft Visual Studio 8
[0] None
Compiler: 2
Please verify your choices:
Compiler: Microsoft Visual C++ 2005 SP1
Location: C:\Program Files\Microsoft Visual Studio 8
Are these correct [y]/n? y
***************************************************************************
Warning: Support for Microsoft Visual C++ 2005 SP1 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/R2012a/win32.html
***************************************************************************
Trying to update options file: C:\Users\ MichaelKim\AppData\Roaming\MathWorks\MATLAB\R2012a\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2012a\bin\win32\mexopts\msvc80opts.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/techdoc/matlab_external/bsflnue-1.html
Building with the -largeArrayDims option enables the new API.
**************************************************************************
>> mex mhaLoad.cpp
C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: 'mhaLoad.cpp' not found.
*Error using mex (line 206)
Unable to complete successfully.*
is there are simple way to solve?
I'm working on Win 7 32bit, matlab R2012a.
Thanks :)
  댓글 수: 2
Ahmad Naghavi
Ahmad Naghavi 2020년 5월 5일
편집: Ahmad Naghavi 2020년 5월 5일
I have got somewhat the same situation. I have a C code which has been compiled through a linux version of MATLAB, and its extension is 'mexglx'. Now that I am trying to compile the C source code under the Windows version of MATLAB, I am getting errors saying that the syntax is old somehow! But the point is that the error is pertaining to the main and genuine C files of MATLAB directory itself. This is the output I get:
Error using mex
multithread_ks_simulator.c
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls.h(193) : error C4980: '__value' : use of this keyword requires
/clr:oldSyntax command line option
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls.h(193) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls.h(196) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls.h(202) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls.h(205) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls.h(231) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls.h(235) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls.h(346) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls.h(350) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_float.h(193) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_float.h(196) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_float.h(202) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_float.h(205) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_float.h(231) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_float.h(235) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_float.h(346) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_float.h(350) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_long_double.h(193) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_long_double.h(196) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_long_double.h(202) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_long_double.h(205) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_long_double.h(231) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_long_double.h(235) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_long_double.h(346) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\bits/mathcalls_long_double.h(350) : error C2059: syntax error : '__value'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\stddef.h(15) : error C2054: expected '(' to follow '__SIZE_TYPE__'
C:\Program Files\MATLAB\R2016b\polyspace\verifier\cxx\include\include-libc\stddef.h(18) : error C2085: '__WCHAR_TYPE__' : not in formal parameter list
In fact, I have searched for any solution, and then I was directed here. I would be so happy if you help me with this.
Thanks.
Walter Roberson
Walter Roberson 2020년 8월 27일
https://social.msdn.microsoft.com/Forums/vstudio/en-US/adabf801-8006-47bd-9495-972e04df5c78/use-of-value-as-a-variable-name-in-unmanaged-c-code?forum=vcgeneral

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

채택된 답변

Jan
Jan 2012년 10월 20일
You get this error message:
Error: 'mhaLoad.cpp' not found
This means, that MEX cannot find this file. Is it in the current directory? If not, either use CD to adjust the current directory or use a full path name:
mex D:\MatlabFiles\mhaLoad.cpp
  댓글 수: 5
Wendell
Wendell 2017년 1월 22일
I have the same problem...i tried the full path name, but the error is still there.." C:\PROGRA~1\MATLAB\R2013A\BIN\MEX.PL: Error: 'D:\MatlabFiles\Build2Dmeshinfocpp.cpp' not found."
Walter Roberson
Walter Roberson 2017년 1월 22일
편집: Walter Roberson 2017년 1월 22일
Wendell does that file exist? For example should you have used
D:\MatlabFiles\Build2D\meshinfocpp.cpp
Or perhaps
D:\MatlabFiles\Build2Dmeshinfo.cpp

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

추가 답변 (3개)

SAMEER ahamed
SAMEER ahamed 2013년 10월 28일
편집: Walter Roberson 2015년 5월 25일
Hi,
I am new for Matlab , please let me know how i cna used viola jones algorithm code in matlab . when i have matlab command window compile mext -setup , i am getting error like please let me know step by step process , how would like to compile ?
.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.

nyanphyo aung
nyanphyo aung 2015년 5월 25일
what version of you use matlab... matlab 2007b and visual studio 2000 will be ok,and truetime 1.5
  댓글 수: 1
Walter Roberson
Walter Roberson 2015년 5월 25일
"Visual Studio 2000" seems to be Microsoft Visual C++ version 6.0. MATLAB R2007b supported that for Windows 32 but not for Windows 64, for which Visual C++ 2005 SP1 (version 8.0) was the earliest supported product in that line. Microsoft SDK 14.0 was supported for Windows 64 but not for Windows 32. The C++ 2005 SP1 was supported for both.

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


Prasoon Garg
Prasoon Garg 2018년 3월 12일
편집: Prasoon Garg 2018년 3월 12일
Hi all,
*For macOS only*** All the problems related to mex are resolved after the installation of Xcode. After installing Xcode, run the command:
mex -setup
After this try to run the code.
  댓글 수: 1
Alejandro Dominguez Guadarrama
Alejandro Dominguez Guadarrama 2020년 8월 27일
I'm working with version R2016b and I have Xcode installed. The problem in this case is the version of Xcode. Documentation of Matlab states the R2016b needs Xcode 6.x, 7.x, but I have Xcode 11.x.
I try running "mex -setup" but it doesn't work, I get the message...
"Error using mex
No supported compiler or SDK was found. For options, visit
http://www.mathworks.com/support/compilers/R2016b/maci64.html. "
Any idea how to solve this issue?
Alex

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

카테고리

Help CenterFile Exchange에서 Troubleshooting in MATLAB Compiler SDK에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by