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
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