Why do I receive compile time syntax errors when using MATLAB Compiler with the Builder products?

21 views (last 30 days)
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

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 22 Jan 2010
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.

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!