Mex files and C code

2 次查看(过去 30 天)
Juan Carlos
Juan Carlos 2014-3-4
Hello,
May someone help me? I am testing a C code previously generated with Matlab-Coder (the code inside has a lot of operations with matrixes), I must to test it using a MEX file but matlab is showing me an error, like this:
>> mex MEX_ANAVS.c
Building with 'Microsoft Visual C++ 2012 (C)'.
Error using mex
MEX_ANAVS.c
c:\program files\matlab\r2014a\extern\include\matrix.h(261) : error C2061: syntax error : identifier 'mxLogical'
c:\program files\matlab\r2014a\extern\include\matrix.h(261) : error C2059: syntax error : ';'
c:\program files\matlab\r2014a\extern\include\matrix.h(266) : error C2061: syntax error : identifier 'mxChar'
c:\program files\matlab\r2014a\extern\include\matrix.h(266) : error C2059: syntax error : ';'
c:\program files\matlab\r2014a\extern\include\matrix.h(427) : error C2061: syntax error : identifier 'mxIsNumeric'
c:\program files\matlab\r2014a\extern\include\matrix.h(427) : error C2059: syntax error : ';'
c:\program files\matlab\r2014a\extern\include\matrix.h(427) : error C2059: syntax error : 'type'
c:\program files\matlab\r2014a\extern\include\matrix.h(432) : error C2061: syntax error : identifier 'mxIsCell'
c:\program files\matlab\r2014a\extern\include\matrix.h(432) : error C2059: syntax error : ';'
c:\program files\matlab\r2014a\extern\include\matrix.h(432) : error C2059: syntax error : 'type'
c:\program files\matlab\r2014a\extern\include\matrix.h(437) : error C2061: syntax error : identifier 'mxIsLogical'
c:\program files\matlab\r2014a\extern\include\matrix.h(437) : error C2059: syntax error : ';'
c:\program files\matlab\r2014a\extern\include\matrix.h(437) : error C2059: syntax error : 'type'
c:\program files\matlab\r2014a\extern\include\matrix.h(442) : error C2061: syntax error : identifier 'mxIsChar'
Thank you so much in advance! :)
Juan
  2 个评论
Skyler Shuford
Skyler Shuford 2016-8-17
Did you ever get a solution for this? I'm having the same problem.
Shivaram Singh Rajput
Hi Skyler, did you get a solution to this?

请先登录,再进行评论。

回答(1 个)

mirka
mirka 2016-10-24
编辑:mirka 2016-10-24
Hello! I give a answer for other people although you already solved this prob. I got a same problem when compiling the c code (like "file_name.c" ) with 'Microsoft Visual C++ 2012 (C)'. The problem is the compiler. just change the c code file name to cpp file.(file_name.c -> file_name.cpp) then it may works. :)
I hope it helps yo!

类别

Help CenterFile Exchange 中查找有关 C Shared Library Integration 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by