Mex files and C code

1 view (last 30 days)
Juan Carlos
Juan Carlos on 4 Mar 2014
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 Comments
Skyler Shuford
Skyler Shuford on 17 Aug 2016
Did you ever get a solution for this? I'm having the same problem.
Shivaram Singh Rajput
Shivaram Singh Rajput on 11 Jan 2018
Hi Skyler, did you get a solution to this?

Sign in to comment.

Answers (1)

mirka
mirka on 24 Oct 2016
Edited: mirka on 24 Oct 2016
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!

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!