MATLAB: Do I receive compile time syntax errors when using MATLAB Compiler with the Builder products

ccompileerrorkeywordsMATLAB Compilernamessyntaxvariable

Why do I receive compile time syntax errors when using MATLAB Compiler with the Builder products?
When I try to compile the following segment of code:
function [out, stderr] = test(stdin)
disp('Hello World')
out = 1;
stderr = 'none';
using MATLAB Compiler as follows:
mcc -m test
I receive the following compile time error message:
test.c
h:\Documents\work\test.h(27) : error C2143: syntax error : missing ')' before '&'
h:\Documents\work\test.h(27) : error C2143: syntax error : missing ')' before '&'
[snip]
test.c(32) : error C2143: syntax error : missing ')' before '&'
test.c(32) : error C2143: syntax error : missing ')' before '&'
test.c(32) : error C2143: syntax error : missing '{' before '&'
test.c(32) : error C2059: syntax error : '&'
[snip]
test.c(96) : warning C4013: 'Mtest' undefined; assuming extern returning int
test.c(96) : warning C4047: '=' : 'mxArray *' differs in levels of indirection from 'int'
test.c(117) : error C2143: syntax error : missing ')' before '&'
test.c(117) : error C2143: syntax error : missing ')' before '&'
[snip]
MBUILD.BAT: Error: Compile of 'test.c' failed.
??? Error using ==> mbuild
Unable to complete successfully
??? Error: An error occurred while shelling out to mbuild (error code = 1).
Unable to build executable.
Error in ==> \\Pc2unix\ARCHIVE\R13\fcs\perfect\toolbox\compiler\mcc.dll

Best Answer

These compile time errors are caused by the use of C/C++ keywords like stdin, stderr, etc. for variable names in your MATLAB code. To resolve this issue, you will need to rename these variable names to non-reserved keywords for C/C++ and MATLAB.