mex compiling syntax error in 32-bit but not in 64-bit

2 views (last 30 days)
Hi all,
I am just getting started with the process of trying to develop a MEX interface to an external C application. I was able to successfully mex the "timestwo.c" example MEX file in 64-bit Matlab (R2011a) using:
%after copying "timestwo.c" to my working directory
mex timestwo.c
This compiled without any errors, and I was able to run the timestwo() function without difficulty.
However, when I tried to run the exact same mex command using 32-bit Matlab (R2011b) on the same machine, I get the following errors: -----------------------------------------
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(29) : error C2061: syntax error : identifier 'size_t'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(29) : error C2059: syntax error : ';'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(92) : error C2061: syntax error : identifier 'size_t'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(93) : error C2061: syntax error : identifier 'ValidBytesConst'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(93) : error C2059: syntax error : ';'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(98) : error C2061: syntax error : identifier 'WritableElementsConst'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(98) : error C2059: syntax error : ';'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(99) : error C2061: syntax error : identifier 'WritableBytesConst'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(99) : error C2059: syntax error : ';'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(104) : error C2061: syntax error : identifier 'ElementSizeConst'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(104) : error C2059: syntax error : ';'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(108) : error C2059: syntax error : '}'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(123) : error C2061: syntax error : identifier 'size_t'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(124) : error C2061: syntax error : identifier 'ValidBytesConst'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(124) : error C2059: syntax error : ';'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(129) : error C2061: syntax error : identifier 'WritableElementsConst'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(129) : error C2059: syntax error : ';'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(130) : error C2061: syntax error : identifier 'WritableBytesConst'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(130) : error C2059: syntax error : ';'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(135) : error C2061: syntax error : identifier 'ElementSizeConst'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(135) : error C2059: syntax error : ';'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(140) : error C2059: syntax error : '}'
[many more errors follow]
-----------------------------------------
(The line breaks are a formatting artifact of this forum--each line of the actual output starts with "C:\Program Files").
I have already completed the mex -setup configuration for Visual Studio with both versions of Matlab; both setups completed without error.
I have attached my sourceannotations.h file to this post (renamed to .txt to comply with the file extension requirements of this forum). The error seems to stem from a missing size_t declaration, but (by my reading of the code), size_t is clearly defined as a typedef in lines 27 and 29 of the header file. The other identifiers that throw a syntax error, such as 'ValidBytesCount' and 'WritableElementsConst' are also defined as size_t variables, so I assume they also stem from this same issue.
My online searches suggested that there is a misplaced semicolon somewhere in this header file, but I cannot seem to track it down. Further, I would expect that the 64-bit mex routine would require this file as well, no?
Any assistance you can provide would be greatly appreciated. I am quite new to the world of Mex, and haven't really touched C/C++ in over a decade!

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!