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

조회 수: 21 (최근 30일)
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

채택된 답변

MathWorks Support Team
MathWorks Support Team 2010년 1월 22일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by